How to clear all checkbox When checkbox id=\"checkAll\"
are checked ?
in my demo , when user checked checkbox id=\"checkAll\"
all checkbox are
You shouldn't use the same ID for multiple elements, since IDs are unique. Instead use class="checkedItem"
.
If you want to clear all use
$('#checkAll').click(function () {
$('input:checkbox').prop('checked', !this.checked);
});
However this also clears the first checkbox. To prevent this use
$('#checkAll').click(function () {
$('input:checkbox').not(this).prop('checked', !this.checked);
});