JSFiddle - React, Tailwind, and code Playground
HTML
<input class='user_roles' id="chk" type=checkbox></input>
<input id="btn_on" type="button" value="on" />
<input id="btn_off" type="button" value="off" />
JavaScript
$('#chk').click(function() {
var $this = $(this);
setTimeout(function() {
if ($this.prop("checked") === true) {
alert("checked");
}
else {
alert("not checked");
}
}, 10);
});
$("[id$=btn_on]").click(function() {
$('#chk').click();
});
$("[id$=btn_off]").click(function() {
$('#chk').click();
});