JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="chk" onclick="func()">
<script>
var b=document.getElementById("chk");
if(b.checked == true){
alert("hey");
}
</script>
<input type="checkbox" id="chk" onclick="func()">
<script>
var b=document.getElementById("chk");
if(b.checked == true){
alert("hey");
}
</script>