Skip to content Skip to sidebar Skip to footer

How To Find And Check All Dynamic Child Checkboxes In Tree Using Jquery?

I have added check-boxes dynamically to all the element and successfully added the functionality to select all checkboxes but not able to do the selection for the parent child chec

Solution 1:

try something along these lines:

$this.children('input[type="checkbox"]').prop('checked', true);

Solution 2:

The following will check all children checkboxes, deeper than 1 level using find rather than children.

$(document.body).on('change', 'input[type=checkbox]', function(){
    if($(this).is(':checked')){
        $(this).find('input[type="checkbox"]').prop('checked', true);
    }
});

Post a Comment for "How To Find And Check All Dynamic Child Checkboxes In Tree Using Jquery?"