tags:

views:

498

answers:

2

I got one main search field always visible at the site and a login form (by default hidden) only visible if the login button is pushed (this trigger a jQuery toggle function).

I have no problem getting the main search field to have focus, but I want the first element in the login form to have focus if visible.

In the HTML code, the the hidden div whith the login form is placed before the main search field div.

Please help!

+1  A: 

Your toggle code:

$("selector").toggle("fast", function() {
  $("#login").focus();
});
Andy Gaskell
Thank you! But is it possible to do this without the animation?
jorgen
I found out myself.
jorgen
A: 

Thanks worked fine

Dilli