一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

jQuery实现复选框的全选和反选

时间:2022-06-25 17:18:38 编辑:袖梨 来源:一聚教程网

代码如下 复制代码

Document

苹果

香蕉

橘子

// 全选

function allPick() {

$("[type=checkbox]:checkbox").each(function () {

this.checked = true;

})

}

// 全不选

function unAllPick() {

$("[type=checkbox]:checkbox").each(function () {

this.checked = false;

})

}

// 反转

function inverserPick() {

$("[type=checkbox]:checkbox").each(function () {

this.checked = !this.checked;

})

}

热门栏目