JSFiddle - React, Tailwind, and code Playground
by j08691
HTML
<input type="checkbox" id="chk" />
<br>
<button id="btn">Click me</button>
<br>Checed attribute:
<label id="lbl">Unchecked</label>
JavaScript
$("#btn").click(function () {
var chk = $("#chk").prop("checked");
$("#chk").prop("checked", !chk);
if (!chk === true) {
$("#lbl").text("Checked");
} else {
$("#lbl").text("Unchecked");
}
});