I have a table of checkboxes. At the top is an Administrator box, then below a bunch of other permissions. If the Admin box is checked all other boxes should be checked, and if another box is unchecked then the Admin box should uncheck. I have it working on the initial click but if you click the Admin box it checks all others, then uncheck an other option it unchecks the Admin. Check the Admin a second time and nothing happens.
$("#administrator").click(function(){
if ($(this).is(':checked')) {
$('.permissions').attr('checked',true);
}
});
$(".permissions").click(function(){
if ($(this).is(':checked')) {
} else {
$('#administrator').attr('checked',false);
}
});