Home > Web Front-end > JS Tutorial > jquery selects all/does not select/reverseselect another implementation method (with native js)_jquery

jquery selects all/does not select/reverseselect another implementation method (with native js)_jquery

WBOY
Release: 2016-05-16 17:38:15
Original
1067 people have browsed it
复制代码 代码如下:






<script> <br>$(document).ready(function(){ <br>$("#selectAll").click(function(){ <br>//这里也可以直接用this,原生js语句 <br>if($(this)[0].checked){ <br>$('[name=items]:checkbox').attr("checked",true); <br>}else{ <br>$('[name=items]:checkbox').attr("checked",false); <br>} <br>}); <br>$("#XOR").click(function(){ <br>$("[name=items]:checkbox").each(function(){ <br>this.checked=!this.checked; <br>}); <br>}); <br>}); <br></script>
Untitled Document


足球
足球
足球
足球
全选/全部选



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template