Generally, the first thing hit by the TAB key is the page address. Then it hits links in the order in which they appear in the code.
You can override that with JavaScript, but it'll surprise your viewers, usually.
This can be an especial pain if you have JavaScript that makes the page, say, hit a server-side database, and then reload, because your cursor focus is back up just-prior-to-the-address-bar. So the trick there is to deliberately place the focus where you want it.
There was a little talk about this is thread216-485313
Cheers,
Edward
"Cut a hole in the door. Hang a flap. Criminy, why didn't I think of this earlier?!" -- inventor of the cat door
Edward, thanks for posting. I have a couple of questions...
I'm not sure what you mean by "the page address" when you say this is the first thing hit by the TAB key.
Also, I have a text box that has focus, but there is always one button that has a darker border that indicates it as the default. That is what I'm hoping to change... either have a different button be the default or not have the darker border around any of them.
Sorry I'm not completely understanding what you're telling me.
By page address, I think Edward is referring to the address bar where is the URL string is entered.
If you are using <input> tags for your buttons, then when type="submit" becomes your default button. You can either change the type to "submit" for the one button you want to have focus. Or you can set type = "button" for all of them if you don't want any default button.
If it makes sense, I think it is always good to have a default action. Why make me move my mouse when I can just hit 'Enter' to submit my form.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.