Jquery for Select All Checkbox
A very common interface is a list of items with a checkbox to select each and them you perform an action on those selected. Typically you have a checkbox at the top to toggle all of the list. This script will take care of everything for you. You can exclude elements by checking the ID or name properties.
$(document).ready(function() {
$("#selectAllCheckBox").click(function() {
var checked_status = this.checked;
$("input[type=CheckBox]").each(function() {
if (this.id != "pleaseSkipMe") {
this.checked = checked_status;
}
});
});
});
Comments
$(function() {
$("#selectAllCheckBox").click(function() {
$(':checkbox').not('#pleaseSkipMe').attr('checked', this.checked);
});
});