JSFiddle - React, Tailwind, and code Playground
by techunter
HTML
<div class="markerDiv" id="maker_school">
<label class="marker_label">School</label>
<input class="marker_ckeckbox" name="markerType" value="school" type="checkbox" />
</div>
<br />
CSS
.markerDiv {
width:200px;
background:lightgrey;
}
JavaScript
$(".markerDiv").click(function () {
if ($(this).find('input:checkbox[name=markerType]').is(":checked")) {
$(this).find('input:checkbox[name=markerType]').prop("checked", false);
} else {
$(this).find('input:checkbox[name=markerType]').prop("checked", true);
}
alert($(this).find('input:checkbox[name=markerType]').is(":checked"));
});