JSFiddle - React, Tailwind, and code Playground
by Ehsan Sajjad
HTML
<input type="checkbox" id="chk1" class="chk"/>
<input type="checkbox" id="chk2" class="chk"/>
<input type="checkbox" id="chk3" class="chk"/>
JavaScript
$('.chk').change(function(){
if(this.id === "chk3")
$(".chk").prop("checked",this.checked);
if(this.id === "chk2")
{
$(".chk").prop("checked",!this.checked);
$("#chk3").prop("checked",!this.checked);
}
})