JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="checkAll" /> Check/Uncheck <br/>
<div id="checkboxes" style="padding:10px;">
<input type="checkbox" /><br/>
<input type="checkbox" /><br/>
<input type="checkbox" />
</div>
JavaScript
$('#checkAll').click(function(e) {
if($('#checkAll').attr('checked') == 'checked') {
$("#checkboxes input").attr('checked','checked');
$('#checkAll').val('off');
} else {
$("#checkboxes input").attr('checked', false);
$('#checkAll').val('on'); Update
}
});