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.

Recommended Answers

All 2 Replies

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.

Also setting the <input> 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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.