JSFiddle - React, Tailwind, and code Playground
HTML
<input type="text" id="test" />
<input type="text" id="dummy" />
JavaScript
$('#test')[0].onchange = function() {
console.log('foo #1');
};
$('#test').change(function() {
console.log('foo #2');
});
var evt = document.createEvent("KeyboardEvent");
evt.initKeyEvent("keypress",true,true,null,false,false,false,false, 77, 77);
$('#test')[0].dispatchEvent(evt);
$('#dummy').focus();