How to clear all checkbox When checkbox id=\"checkAll\" are checked ?
in my demo , when user checked checkbox id=\"checkAll\" all checkbox are
You can use change() function and it you can check by using this.checked inside the change event, it will return boolean value for checkbox checked status :
$('#checkAll').change(function () {
$('input:checkbox').prop('checked', this.checked); // all checked on check of #checkAll
});
$('#checkAll').change(function () {
$('input:checkbox').prop('checked', !this.checked); // all unchecked on check of #checkAll
});
if you want all unchecked but no the main check box then:
$('#checkAll').change(function () {
$('input:checkbox').not(this).prop('checked', !this.checked); // all unchecked on check of #checkAll but not itself
});