JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="chk" value="value" name="test" />
<label for="chk">Value </label>
<br/>
<input type="button" id="But1" value="change value (working)" />
JavaScript
$('#But1').click(function () {
checkit('Before');
var current = $('#chk').is(':checked')
$('#chk').prop({'checked': !current});
checkit('After');
});
$('#chk').on( 'change',function () {
checkit('Result');
});
function checkit(moment) {
var chk1 = $('#chk').is(':checked');
console.log(moment+", value = " + chk1);
};