JSFiddle - React, Tailwind, and code Playground
HTML
<input type="button" value="select all" value="click me" id="button1" />
<input type="checkbox" id="checkX" class="allchecks" value="show" /><input type="checkbox" id="checkX" class="allchecks" value="show" /><input type="checkbox" id="checkX" class="allchecks" value="show" /><input type="checkbox" id="checkX" class="allchecks" value="show" /><input type="checkbox" id="checkX" class="allchecks" value="show" /><input type="checkbox" id="checkX" class="allchecks" value="show" />
<br/>
<input type="button" value="select all 2" value="click me" id="button2" />
JavaScript
$j = jQuery.noConflict();
$j('#button1').click(function(){
$j('.allchecks:not(:checked)').trigger('click');
}); // end click
$j('#button2').click(function(){
$j('.allchecks').each(function(){
if(!$j(this).is(':checked')){
$j(this).trigger('click');
}
}); // end each
}); // end click