0

I have 4 text fields. When i enter a value in first text box cursor should move to next text box. That is onkeyup() i need to perform action of tab key. Is there any javascript or jquery for that

Yadhu Phinix
  • 57
  • 1
  • 1
  • 7
  • 1
    you can call `inp.focus()` on the next one it should go to. – dandavis Mar 03 '16 at 07:04
  • You can find your answer here http://stackoverflow.com/questions/3362/capturing-tab-key-in-text-box – Alankar More Mar 03 '16 at 07:05
  • 4
    Possible duplicate of [use jQuery to move the cursor to another field when a certain character is typed?](http://stackoverflow.com/questions/5198061/use-jquery-to-move-the-cursor-to-another-field-when-a-certain-character-is-typed) – Divyesh Savaliya Mar 03 '16 at 07:06

1 Answers1

1

You can try this

HTML

<input type="text" class="focus" />
<input type="text" class="focus" />
<input type="text" class="focus" />
<input type="text" class="focus" />

JS

  $(".focus").keyup(function(){
   if($(this).val() != "")
   {
    $(this).next(".focus").focus();
   }
  });
mry
  • 314
  • 2
  • 11