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()
{
  $("#1").trigger("change").prop("checked", !$("#1").prop("checked"));
 
})
$(document).on("change","#1",function()
{
    alert("changed")
})