//全选
$('.allbox').click(function() {
if($('.allbox').is(':checked')) {
$('.singlebox').each(function() {
$(this).prop('checked', true);
//$('#orChecked').prop('checked',true);
})
} else {
$('.singlebox').each(function() {
$(this).prop('checked', false);
//$('#orChecked').prop('checked',false);
})
}
});
//复选框点击事件(实现复选框与全选框的反选)
function temCheckBox() {
var flag = false;
$('.singlebox').each(function() {
//alert($(this).is(':checked'))
if(!$(this).is(':checked')) {
flag = true
}
})
$("#orChecked").prop('checked', false);
if(!flag) {
$("#orChecked").prop('checked', true);
}
}
HTML:
//全选 //单选 ```