<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />
<input class="inputs" type="text" maxlength="4" />


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

  

相关文章: