JSFiddle - React, Tailwind, and code Playground
HTML
<input id="toChange" type="text">
JavaScript
function changeFunction() {
alert("Changed");
}
$(document).ready(function() {
var inputbox = $("#toChange");
inputbox.on('change', changeFunction);
inputbox.on('paste', changeFunction);
//Can attach other functions, though beware of multiple triggers
});
//SetTimeout in place of whatever code does the changing
window.setTimeout(function() {
var inputbox = $("#toChange")
inputbox.val("Set by function");
inputbox.trigger("change");
}, 3000);