Hey All,
I’m dabbling in a little DHTML to show/hide a fieldset on a page, w/
the following:
<%=
link_to_function(“Show People”, nil, :id => “more_link”) do |page|
page.visual_effect(:toggle_appear, “organization-people”)
page.replace_html(“more_link”, “Hide People”)
end
%>
This works very nicely, except for one thing–when the page loads, the
link attached to the resulting jscript function is “Show People”. The
first time I click it changes to “Hide People” & the fieldset appears–
all very nice. My problem is that I don’t know how to change the link
text back to “Show People” once the user clicks a second time. The
link always does what I want–showing or hiding as appropriate, but
it only says what I want for the first two clicks.
Is there a way to find out what the current link contains so I can
make that call to replace_html conditional?
Many thanks!
-Roy