visual_effect and change focus

Hello -

I am using a visual_effect like this:

<p><%= link_to "Question #1", "#", :onclick => visual_effect(:toggle_blind, 'question1') %> </p>

<div id="question1" style="display:none"> <p>Question #1: Answer</p> </div>

So that when the link to Question #1 is clicked on, it drops down the answer in the hidden <div> right below the question. How can I change the focus, so that the browser window focus doesn't jump to the top of the screen, but instead focuses on my hidden div?

Thanks for any help!!

LAB

LAB wrote:

Hello -

I am using a visual_effect like this:

<p><%= link_to "Question #1", "#", :onclick => visual_effect(:toggle_blind, 'question1') %> </p>

<div id="question1" style="display:none"> <p>Question #1: Answer</p> </div>

So that when the link to Question #1 is clicked on, it drops down the answer in the hidden <div> right below the question. How can I change the focus, so that the browser window focus doesn't jump to the top of the screen, but instead focuses on my hidden div?

Thanks for any help!!

LAB

Well, I guess you could make an href that points to "#question1"...

Lake

Ah, ha! That's what I was missing ... this fixes it ...

<p><%= link_to "Question #1", "#question1", :onclick => visual_effect(:toggle_blind, 'question1') %> </p>

note the addition of "question1" after the #, passed as the 2nd parameter.

Thanks!! LAB