Hide & Show div (Element.toggle)

I have 2 divs:

<%= link_to_function("Show div2", "Element.toggle('div2')") %>
<%= link_to_function("Show div1", "Element.toggle('div1')") %>

I want, when I click link: “Show div2” it hide div1 and show div2,
when i click “Show div1” it hide div2 and show div1

How can i do it?

On Dec 26, 5:14 pm, Gi Ga [email protected] wrote:

How can i do it?
just make your call to link_to function toggle both divs - you aren’t
limited to a single javascript statement.

Fred

Frederick C. wrote:

On Dec 26, 5:14�pm, Gi Ga [email protected] wrote:

How can i do it?
just make your call to link_to function toggle both divs - you aren’t
limited to a single javascript statement.

Fred

I can’t make it work :frowning:

By default div2 is hidden:

<%= link_to_function("Show div2", "Element.toggle('div1', 'div2)") %>
<%= link_to_function("Show div1", "Element.toggle('div1', 'div2')") %>

On 26 Dec 2008, at 19:32, Gi Ga wrote:

I can’t make it work :frowning:
Just make two calls to Element.toggle

Fred

Sample:

Element.toggle(‘div1’); Element.toggle(‘div2’);


Shiv

On Sat, Dec 27, 2008 at 1:29 PM, Gi Ga
[email protected]wrote:

Sample?

Posted via http://www.ruby-forum.com/.

Henny Youngman - “If at first you don’t succeed… so much for
skydiving.”

Sample?