Setting the Tab Order in a Form

By pressing the Tab key, visitors can move the focus through the fields in your form from top to bottom (and then select the desired one by pressing Return). Depending on your form’s layout, you may prefer to set the tab order yourself so that the visitor fills out all the fields in a particular group before going on to the next group.

To set the tab order:

In the form element’s tag, type tabindex="n", where n is the number that indicates the tab order.

Figure 17.54. By setting the tabindex, you control the order in which your visitor can tab through the fields.

✓ Tips

  • Getting the focus means the form element ...

Get HTML, XHTML, & CSS, Sixth Edition: Visual QuickStart Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.