function selectAllCheckbox(){
var flag = $("#selectAll").attr("checked");
if(flag){
$("input[name=box]").attr("checked",true);
}else{
$("input[name=box]").attr("checked",false);
}
}
function reverseSelect(){
$("input[name=box]").each(function(index,obj){
$(this).attr("checked",!$(this).attr("checked"));
});
}
<input type="checkbox" id="selectAll" onchange="selectAllCheckbox()"/>全选/全不选
<input type="checkbox" name="box" />
<input type="checkbox" name="box" />
<input type="checkbox" name="box" />
checkbox全选 全不选 反选
最新推荐文章于 2023-10-23 14:09:15 发布