JSFiddle - React, Tailwind, and code Playground

by whoamiwho

HTML

<input type="checkbox" id="CheckedAll">
    <hr>
<input type="checkbox" name="items">
<input type="checkbox" name="items">
<input type="checkbox" name="items">

JavaScript

$("#CheckedAll").click(function () {
     $('input[type=checkbox][name=items]').prop("checked", this.checked);
 });

 $('input[type=checkbox][name=items]').click(function () {
     $('#CheckedAll').prop(
         'checked',
     $('input[type=checkbox][name=items]:not(:checked)').length === 0);
 });