http://www.wiseguysonly.com/2010/01/15/select-and-unselect-all-checkboxes-with-jquery/

 Check if all checkboxes are selected

$('.abc:checked').length == $('.abc').length

You could do it every time a new checkbox is checked:

$(".abc").change(function(){if($('.abc:checked').length == $('.abc').length){//do something}};

If we want to check initailly if all check box are checked:

function check_all_add(){

if ($('.add:checked').length == $('.add').length) {

$(".add_all").attr("checked", 'checked');
}
else{
$(".add_all").attr("checked", '');
}
}

$(document).ready(function(){

check_all_add();
$(".add").change(function(){
check_all_add();
});

});

Advertisements