I have a form and group of checkboxes in it. (These checkboxes are dynamically created but I dont think it is important for this question). The code that generates them look
You can use jQuery like so:
jQuery
$('[name="ALL"]:checkbox').change(function () { if($(this).attr("checked")) $('input:checkbox').attr('checked','checked'); else $('input:checkbox').removeAttr('checked'); });
A fiddle.