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[]”.
$('#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); } }); });