I'm dabbling in a little DHTML to show/hide a fieldset on a page, w/
link_to_function("Show People", nil, :id => "more_link") do |page|
page.replace_html("more_link", "Hide People")
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?