JSFiddle - React, Tailwind, and code Playground
HTML
<label for="check-1"><input id="check-1" type="checkbox" class="check-group" checked="checked" />check-1</label>
<label for="check-2"><input id="check-2" type="checkbox" class="check-group" />check-2</label>
<label for="check-3"><input id="check-3" type="checkbox" class="check-group" />check-3</label>
JavaScript
$(function () {
var checkGroup = $(".check-group");
checkGroup.on("click", function (e) {
var anySelected = false;
checkGroup.each(function () {
if ($(this).prop('checked')) {
anySelected = true;
return;
}
});
if (!anySelected)
e.preventDefault();
return anySelected;
});
})