<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();
    }
});

  

posted on 2019-01-03 23:00  FreeSpider  阅读(199)  评论(0编辑  收藏  举报