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').change(function() {
    if($(this).prop("checked") === true) {
        alert ("checked");   
    }
    else{
        alert ("not checked");
    }
});

        $("[id$=btn_on]").click(function () {
                $('#chk').click();
        });
                                
        $("[id$=btn_off]").click(function () {
                $('#chk').click();
        });