question about Element.toggle

I'm currently doing this:

<%= link_to_function h(course.title),
"Element.toggle('course#{}')" %>

Is there a way to:

(a) Extend this so that instead of simply clicking on a title to
toggle the element the user can click on a plus symbol that shows the
div which also changes the plus symbol to a minus symbol. Clicking on
the minus symbol would then hide the div and also change the minus
symbol back to plus. I've seen this on quite a few websites so I
think you know what I'm talking about :slight_smile:

(b) Have some effect on toggling the element. I googled around and
tried this, but it doesn't seem to work:

<%= link_to_function h(course.title),
"Element.toggle('course#{}', 'blind')" %>

Any ideas?

Hi Vince,

The prototype Element.toggle changes the visibility of an element. I use
scriptaculous for element effects.

You should be able to string a couple of prototype & scriptaculous
statements together to get what you what like so..

:onclick => "Element.toggle('plus_id'); Element.toggle('minus_id');

That should point in you in one possible direction.


Tickex - the concert, theatre, & sports search engine for tickets

vince wrote: