Feb10
The “select all” checkbox to select all checkboxes
Posted by: Brian Chan | Filed in: technology | Tags: programming | 05:07 pm, February 10th, 2012 Add comments
Below is what you need for a “select all” checkbox to toggle the rest of the checkboxes. Below assumes your checkboxes all have the name “my_chkboxes[]“.
1 2 3 4 5 6 7 8 9 | $('#my_select_all').click(function(){
$("input[name='my_chkboxes[]']").each(function (index, el) {
if ($('#my_select_all').is(':checked')) {
$(el).attr('checked', 'checked');
}else{
$(el).attr('checked', false);
}
});
}); |
Related posts:
- Disallow de-select when select-all is checked
- selecting checkboxes
- Select the last option of a drop down
- PHP array delete an item
- CLLocationManager error