jquery实现的复选框全选与反选
来源:懂视网
责编:小采
时间:2020-11-27 20:32:21
jquery实现的复选框全选与反选
jquery实现的复选框全选与反选:此代码简单但适用。 var tog = false; // or true if they are checked on load $('a').click(function() { $(input[type=checkbox]).attr(checked,tog); tog = !tog; }); 需要的码农可以拿去实验一下,效果不错
导读jquery实现的复选框全选与反选:此代码简单但适用。 var tog = false; // or true if they are checked on load $('a').click(function() { $(input[type=checkbox]).attr(checked,tog); tog = !tog; }); 需要的码农可以拿去实验一下,效果不错

此代码简单但适用。
var tog = false;
// or true if they are checked on load
$('a').click(function() {
$("input[type=checkbox]").attr("checked",!tog);
tog = !tog;
});
需要的码农可以拿去实验一下,效果不错。
jquery实现的复选框全选与反选
jquery实现的复选框全选与反选:此代码简单但适用。 var tog = false; // or true if they are checked on load $('a').click(function() { $(input[type=checkbox]).attr(checked,tog); tog = !tog; }); 需要的码农可以拿去实验一下,效果不错