JSFiddle - React, Tailwind, and code Playground
HTML
<div id="OuterDivOrBody">
<input type="checkbox" id="checkbox1" />
<label for="checkbox1">Checkbox label</label>
<br />
<br />The confirm result:
<input type="text" id="textbox1" />
</div>
JavaScript
$('#checkbox1').on('change', function () {
if (!this.checked) {
var sure = confirm("Are you sure you want to uncheck it?");
this.checked = !sure;
$('#textbox1').val(sure.toString());
}
});