# Rjs toggle blind effect headache

**URL:** <https://www.ruby-forum.com/t/rjs-toggle-blind-effect-headache/87529>\
**Category:** Rails\
**Created:** [March 3, 2007, 2:15pm UTC](https://www.ruby-forum.com/t/rjs-toggle-blind-effect-headache/87529 "2007-03-03T14:15:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2007, 2:15pm UTC](https://www.ruby-forum.com/t/rjs-toggle-blind-effect-headache/87529/1 "2007-03-03T14:15:44Z")

</div>

I am trying to write a little rjs template that toggles a div.

Aha:

page[:div\_id].toggle

I hear you cry, and yes it works, but what I am trying to do is the  
equivalent of:

Effect.toggle(‘div\_id’, ‘blind’)

Can anybody tell me have to write this in a rjs template??

Any help great fully received.

David.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2007, 2:56pm UTC](https://www.ruby-forum.com/t/rjs-toggle-blind-effect-headache/87529/2 "2007-03-03T14:56:48Z")

</div>

Many thanks, both of these worked:

> page.visual\_effect :toggle\_blind, ‘div\_id’
> 
> page.call ‘Effect.toggle’, 'div\_i

David,

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [March 3, 2007, 2:50pm UTC](https://www.ruby-forum.com/t/rjs-toggle-blind-effect-headache/87529/3 "2007-03-03T14:50:47Z")

</div>

according to:

[http://api.rubyonrails.org/classes/ActionView/Helpers/ScriptaculousHelper.html](http://api.rubyonrails.org/classes/ActionView/Helpers/ScriptaculousHelper.html)

there is a toggle visual effect of :toggle\_blind but it’s a  
scriptaculous helper, not a prototype helper. so try

page[:div\_id].visual\_effect(:toggle\_blind)

or

page.visual\_effect :toggle\_blind, ‘div\_id’

if all else fails

page.call ‘Effect.toggle’, ‘div\_id’, ‘blind’

should do the trick.
