11175
(-- --)
#1
I have 2 divs:
<div id="div1"> <%= link_to_function("Show div2",
"Element.toggle('div2')") %> </div>
<div id="div2"> <%= link_to_function("Show div1",
"Element.toggle('div1')") %> </div>
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?
I have 2 divs:
<div id="div1"> <%= link_to_function("Show div2",
"Element.toggle('div2')") %> </div>
<div id="div2"> <%= link_to_function("Show div1",
"Element.toggle('div1')") %> </div>
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?
just make your call to link_to function toggle both divs - you aren't
limited to a single javascript statement.
Fred
11175
(-- --)
#3
Frederick Cheung 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 
By default div2 is hidden:
<div id="div1">
<%= link_to_function("Show div2", "Element.toggle('div1', 'div2)") %>
</div>
<div id="div2" style="display:none;">
<%= link_to_function("Show div1", "Element.toggle('div1', 'div2')") %>
</div>
Frederick Cheung 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 
Just make two calls to Element.toggle
Fred
Sample:
Element.toggle(‘div1’); Element.toggle(‘div2’);