JSFiddle - React, Tailwind, and code Playground

HTML

<input type="checkbox" id="1">
<input type="button" id="2" value="click">

JavaScript

$(document).on("click","#2",function()
{
    if($("#1").is(":checked") == true)
    {
         $("#1").prop('checked', false);
    }
    else
    {
        $("#1").prop('checked', true);
    }
})
$(document).on("change","#1",function()
{
    alert("changed")
})