JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" id="chkMain" />
        <input type="checkbox" id="chkMain1" />
        <input type="checkbox" id="chkMain2" /> 
        <input class="child" type="checkbox" id="chk1" disabled="true" /> 
        <input class="child" type="checkbox" id="chk2" disabled="true" /> 
        <input class="child" type="checkbox" id="chk3" disabled="true" /> 
        <input class="child" type="checkbox" id="chk4" disabled="true" /> 
        <input class="child" type="checkbox" id="chk5" disabled="true" />

JavaScript

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