javascript - Focusing next text field on condition satisfaction -


i trying learn jquery. have 2 text fields. when length of first field becomes 3 need cursor move next text box. how can accomplish it? please me find answer

<input id="phone_field1" maxlength="3" name="phone_1" type="text"> <input id="phone_field2" maxlength="3" name="phone_1" type="text"> 

my code given here. please me.

do below:

$('#phone_field1').on('input',function(){//or keyup,you can use input rather id   if($(this).val().length == $(this).prop('maxlength')){    $(this).next().focus();   } }); 

add missing bracket.


Comments

Popular posts from this blog

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -