Home  >  Article  >  Web Front-end  >  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
WBOYOriginal
2016-05-16 17:38:151037browse
复制代码 代码如下:






<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


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



Statement:
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