Skip to content Skip to sidebar Skip to footer

Group Checkboxes In Jsfiddle: Part2

Group checkboxes in JSFiddle : Part 1 After solving Part 1 for Global Checkbox for All Check/Uncheck. I have couple other issues to solve. If I unchecked any of the items from li

Solution 1:

Register a callback which will check whether all the checkboxes in the current group is checked or not

$('input[id^=checkall]').click(function(){
    $(this).closest('fieldset').find('input').not(this).prop('checked',this.checked);
});

$(':checkbox').not('[id^=checkall]').click(function(){
    var all = $(this).closest('fieldset').find('[id^=checkall]');
    var chks = $(this).closest('fieldset').find('input').not(all);

    all.prop('checked', chks.length == chks.filter(':checked').length);
})

Demo: Fiddle

Post a Comment for "Group Checkboxes In Jsfiddle: Part2"