Beginner Coder
Beginner Coder

Reputation: 226

how to prevent tab button in form field and jump into another field?

Example : This is my Reservation Form and when i click tab button on keyword then it need to go first name,email,room type but prevent tab from arrival date and directly jump into depature date

enter image description here

and i tried like this from some stack overflow solution.When i click tab button in keyword then it should jump into Full name Field and Last Name Field and prevent tab from tag and jump into direct Age Field.So Is there way to do like thi ?

       <input type="text" name="full name" class="form-control">
       <input type="text" name="last_name" class="form-control">
       <a href="{{ route('banks.index') }}" class=" block-tab ">Go to another Page</a>
       <input type="number" name="age">
       <button type="submit" >Save</button>

      <script>
         $('.block-tab').on('keydown', function(e) {
              if (e.keyCode == 9) e.preventDefault();
        });
     </script>

Upvotes: 0

Views: 394

Answers (1)

Andam
Andam

Reputation: 2167

Use tabindex="-1" to skip an input field for more information you can read the documentation here

<input placeholder="ok"/></br>
<input placeholder="ok"/></br>
<input placeholder="skip" tabindex="-1"/></br>
<input placeholder="ok"/></br>

Upvotes: 2

Related Questions