Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

select() statement and IE jumping to URL bar

Status
Not open for further replies.

tommo6210

Programmer
May 22, 2007
8
GB
Hi,

I want to use the element.select() statement to move the focus to a particular element, which is working fine, however in IE7, when you use the tab key to move to the next element, rather than going to it, the focus jumps up to the URL address bar, rather than to the next form element.

It seems to work fine with focus(), but not with select(), does anyone know a workaround please?

Thanks,
Chris.
 
I want to use the element.select() statement to move the focus to a particular element

Then you'd be using the wrong method. The "focus" method is the correct method to use to give any element focus. The "select" method should only be used if you want to select the element / data in the element.

Given you've said you want to focus the element, why muddy the waters with the "select" method?

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
It seems to work fine with focus(), but not with select(), does anyone know a workaround please?
If it ain't broke, why fix it? I can't think of any situation where using focus() wouldn't be the appropriate method of shifting the focus to an element.

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Enable Apps
 
Or you could just use both....

Using focus doesn't automatically select all the text in a text field, and using select doesn't set th focus there (it just highlights the text).

If you're wanting to select all the text AND move focus to the text field you'll have to use both methods.

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top