JSFiddle - React, Tailwind, and code Playground
HTML
<form action="#" method="post">
<input name="input1" id="input1" placeholder="value1" maxlength="4"/>
<input name="input2" id="input2" placeholder="value2" maxlength="10"/>
<input name="input3" id="input3" placeholder="value3" maxlength="3"/>
</form>
JavaScript
var timeoutObj;
$( ":input" ).keyup(function( event ) {
var _this = $(this);
if(_this.val().length === parseInt($(this).attr("maxlength"))){
timeoutObj = setTimeout(
function(){
_this.next('input').focus();
}, 5000);
}else{
clearTimeout(timeoutObj);
}
}).keydown(function( event ) {
//Prevent Entrer key
if ( event.which === 13 ) {
event.preventDefault();
}
});