create new checkbox event change js trigger code example
Example: does any event get triggered when checked value changes programatically?
var event = document.createEvent("HTMLEvents");
event.initEvent('change', false, true);
checkbox.dispatchEvent(event);