Can you control the tab order of form elements?

They have: 46 posts

Joined: May 2002

Visual Basic programmers can specify the "tab order" of the form elements in their Windows programs.

Can the tab order of form elements on a web page be controlled? How?

Example: I've got a grid of text boxes. 3 across x 4 down = 12 total text boxes. Default tab order is left to right. I want the default tab order to be top to bottom. Can this be done with JavaScript or anything else?

Thanks in advance...

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

Yes, you can have it so each tab goes to another field using JavaScript (onfocus, onblur), but in general it's better to design the form so that the natural tabbing is how it happens. If you want two columns, use two forms?

They have: 46 posts

Joined: May 2002

Isn't "onblur" to broad?

I mean, if one textbox has focus, and then I just click somewhere on the screen, won't onBlur force focus to go to the next textbox?

I only want this to happen if someone is in one textbox and specifically presses the "tab" key...

Regarding multiple forms for multiple columns... stuff needs to be aligned horizontally even though tab order needs to work vertically. But thanks for the idea.

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

onkeypress?

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.