Demo of Managing one checkbox by other using on Change event



1st 2nd

Check and uncheck the 1st checkbox to change the status of 2nd.

JQuery

<script>
$(document).ready(function() {
$("#ckb").change(function(){
var ckb_status = $("#ckb").prop('checked');
if(ckb_status){$( "#ckb2" ).prop( "checked", true );}
else{$( "#ckb2" ).prop( "checked", false );}
$('#d1').html( " <b>Status :</b> " + ckb_status );
});
///////
var ckb_status = $("#ckb").prop('checked');
$('#d1').html( " <b>Status :</b> " + ckb_status );
/////
});
</script>

HTML

 <input type=checkbox id='ckb'> 1<sup>st</sup>
 <input type=checkbox id='ckb2'> 2<sup>nd</sup> 
 <button type='button' class='btn btn-secondary'  id=d1></button>