Home > Web Front-end > JS Tutorial > jquery 实现的复选框全选与反选

jquery 实现的复选框全选与反选

WBOY
Release: 2016-06-01 09:54:30
Original
1103 people have browsed it

此代码简单但适用。

<code class="language-javascript">var tog = false;
// or true if they are checked on load 
$('a').click(function() { 
  $("input[type=checkbox]").attr("checked",!tog); 
  tog = !tog; 
});</code>
Copy after login

需要的码农可以拿去实验一下,效果不错。

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