JSFiddle - React, Tailwind, and code Playground

by dandrade78

HTML

<input class="inputs" type="text" maxlength="4" />A
<input class="inputs" type="text" maxlength="4" />AA
<input class="inputs" type="text" maxlength="4" /><p>
sffds
</p>A
<input class="inputs" type="text" maxlength="4" />A
<input class="inputs" type="text" maxlength="4" />A
<input class="inputs" type="text" maxlength="4" />A

CSS

input { width: 30px; margin: 5px;  }

JavaScript

$(".inputs").keyup(function () {
    if (this.value.length == this.maxLength) {
      var $next = $(this).next('.inputs');
      if ($next.length)
          $(this).next('.inputs').focus();
      else
          $(this).blur();
    }
});