Home  >  Article  >  Web Front-end  >  3分钟写出来的Jquery版checkbox全选反选功能_jquery

3分钟写出来的Jquery版checkbox全选反选功能_jquery

WBOY
WBOYOriginal
2016-05-16 17:18:57921browse
复制代码 代码如下:

//反选
function selectnoALL() {
$("input:checkbox").each(function (i) {
if (this.checked) {
this.checked = false;
} else {
this.checked = true;
}
});
}
//全选
function selectALL() {
var chelength = $("input:checkbox").length;
$("input:checkbox").each(function (i) {
if (i this.checked = true;
}
});
}

3分钟写出来的 估计很多bug
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