How to enable or disable nested checkboxes in jQuery ?

In this article, we will see how to enable or disable nested checkboxes in jQuery. To do that, we select all child checkboxes and add disabled attributes to them with the help of the attr() method in jQuery so that all checkboxes will be disabled.

1. Syntax:

$('.child-checkbox input[type=checkbox]')
    .attr('disabled', true);

2. Example:

Run the program to get the result:




    
    
        How to enable or disable nested
        checkboxes in jQuery?
    
    


    
Govt. employe
ldc clerk watchmen