select one checkbox from multiple MAIN Checkboxes,disable all other MAIN boxes,n enable child checkbox
<pre><code>&lt;input type=&quot;checkbox&quot; id=&quot;chkMain&quot; /&gt;
&lt;input type=&quot;checkbox&quot; id=&quot;chkMain1&quot; /&gt;
&lt;input type=&quot;checkbox&quot; id=&quot;chkMain2&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk1&quot; disabled=&quot;true&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk2&quot; disabled=&quot;true&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk3&quot; disabled=&quot;true&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk4&quot; disabled=&quot;true&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk5&quot; disabled=&quot;true&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk6&quot; disabled=&quot;true&quot; /&gt;
&lt;input class=&quot;child&quot; type=&quot;checkbox&quot; id=&quot;chk7&quot; disabled=&quot;true&quot; /&gt;


$(function(){  
        $(&quot;input[id^=chkMain]&quot;).click ( function() {  
            if( !$(this).is ( &quot;:checked&quot; ) ){       
                $(&quot;.child&quot;).attr ( &quot;disabled&quot; , true );

            }      
            else{       
                $(&quot;.child&quot;).removeAttr ( &quot;disabled&quot; );     
            }   
        }); 
    });</code></pre>

<p>this enables all the child boxes when either chkMain or chkMain1 or chkMain2 are checked.
what i want is: when chkMain is checked the code should disable chkMain1 and chkMain2 but enabling child boxes.
or
 when chkMain1 is checked the code should disable chkMain and chkMain2 but enabling child boxes.</p>
