954,190 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Tab control on hidden input fields

When I have a hidden input field on my webpage and I use the tab key to traverse my fields, the cursor always moves to the hidden input field. This means that I have to press tab twice to move to the next visible field. Is there any way that I can skip the hidden input field when I am using the tab key?
Thanks, B.

bboyle
Newbie Poster
3 posts since Jul 2003
Reputation Points: 10
Solved Threads: 0
 

Sure, just add the "tabindex" parameter to every form field you want the tab key to traverse. For example.

<input type="text" tabindex="0">


Each form field should increment the tabindex (0, 1, 2, ...) in the order you want the tab key to proceed. For elements you don't want the tab key to stop at, set the tabindex to -1.

cscgal
The Queen of DaniWeb
Administrator
19,421 posts since Feb 2002
Reputation Points: 1,474
Solved Threads: 229
 

Also setting the attribute disabled="disabled" will cause the tab key to skip over this field. For visible fields some browsers will gray out the text and others do not. I have not tried this for hidden fields.

hoffman408
Newbie Poster
1 post since Mar 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You