JSFiddle - React, Tailwind, and code Playground

HTML

Check All<input type="checkbox" id="checkall" name="check_all" />

<input type="checkbox" name="department" class="department" value="" />

<input type="checkbox" name="department" class="department" value="" />


<input type="checkbox" name="department" class="department" value="" />
<input type="checkbox" name="department" class="department" value="" />

CSS

.highlight {
   background-color: yellow;
}

JavaScript

$('#checkall').click(function(){

          $(this).nextAll('.department').prop('checked',this.checked);

});