JSFiddle - React, Tailwind, and code Playground
HTML
<form>
<input id="input1" type="text" value=""/>
<input id="input2" type="text" value=""/>
<input type="reset" id="resetbutton" value="X">
</form>
<pre></pre>
JavaScript
$(document).ready(function() {
function handler(e) {
$('pre').append(e.target.id + ' fired!' + '\n');
};
document.getElementById('input1').addEventListener('keyup', handler, true);
$('#input2').bind('keyup', handler);
$('#resetbutton').click(function() {
var event = document.createEvent('KeyboardEvent');
event.initKeyboardEvent('keyup', true, true, null, false, false, false, false, 76, 0);
$('input').each(function() {
this.dispatchEvent(event);
});
});
});