views:

21

answers:

2

Hi, I have two text field boxes; username and password. There is also a checkbox below the username field. Currently pressing the tab button on they keyboard results in the checkbox gaining focus, I would like to override this so that tab key would bring the password field into focus. Does anyone know how to do this using jQuery or how to restructure the HTML to achieve the same effect? Thanks

A: 
   <input type="text" name="user" tabindex=1 /><br />
    <input type="password" name="password" tabindex=2 /><br />
    RemberMe:<input type="checkbox" name="loggedIn" tabindex=3 /><br />

or

   <input type="text" name="user" tabindex=1 />
    RemberMe:<input type="checkbox" name="loggedIn" tabindex=3 /><br />
   <input type="password" name="password" tabindex=2 /><br />

tab index is the attribute to shift focus when tab is clicked.

Praveen Prasad
please provide your html if this doesnt work for you.
Praveen Prasad
+1  A: 

Use tabindex

<input type="text" name="user" tabindex=1 /><br />
    RemberMe:<input type="checkbox" name="loggedIn" value=" " /><br />
    <input type="password" name="password" tabindex=2 /><br />
Loïc Février