0

I want to move cursor to the next input when the maxlength of the current input is reached.But it's not working. So when I have 10 letters for 'Name',my cursor must be moved on 'Country'.

HTML:

<input type="text" id="1"  name="Name"   maxlength="10" />
<input type="text" id="2"  name="Country"  maxlength="9" />
<input type="text" id="3" name="Password"   maxlength="8" />

jQuery:

$(document).ready(function() {

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

});
readJohn
  • 173
  • 8

0 Answers0