JSFiddle - React, Tailwind, and code Playground
HTML
<p id="events"></p>
<div id="cont">
<input type="text" id="input1"/>
<input type="text" id="input2"/>
</div>
JavaScript
(function(){
$('#cont').on('keyup', 'input', function (event) {
var input = this;
if (input.value.length == 4) {
$('#input2').focus();
}
});
$('#cont').on('focusin', 'input', function () {
$('#events').append('focusin of '+this.id+' <br>');
});
$('#cont').on('focusout', 'input', function () {
$('#events').append('focusout of '+this.id+' <br>');
});
})();