JSFiddle - React, Tailwind, and code Playground
HTML
<div id="textspan">Is it valid?</div>
<label>
<input type="checkbox" name="chk[]" id="chk[]" />male</label>
<label>
<input type="checkbox" name="chk[]" id="chk[]" />female</label>
<a id='validate' href='#'>validate</a>
JavaScript
$('#validate').on('click', function () {
if ($('input[name="chk[]"]:checked').length == 0) {
$("#textspan").html('you shoud select one of them');
} else {
$("#textspan").html('Valid!');
}
});