# Problem while using Effect.toggle( )

**URL:** <https://www.ruby-forum.com/t/problem-while-using-effect-toggle/138135>\
**Category:** Rails\
**Created:** [May 20, 2008, 3:04pm UTC](https://www.ruby-forum.com/t/problem-while-using-effect-toggle/138135 "2008-05-20T15:04:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jagdishSRubin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d6d6ee/32.png) [@jagdishSRubin](https://www.ruby-forum.com/u/jagdishSRubin)\
**Post date:** [May 20, 2008, 3:04pm UTC](https://www.ruby-forum.com/t/problem-while-using-effect-toggle/138135/1 "2008-05-20T15:04:45Z")

</div>

Hi I’m new in rails…I have a problem plz help me…

I’m using Effect.toggle in my code. But it is not working…My code  
is like this…

\<%=link\_to\_function “Toggle this”, onClick=“Effect.toggle( ‘ddiv’,  
‘slide’ ); return flase;”%\>

 this is test content

In mozilla nothing happens even i click the link but in IE it shos  
javascript error like:

Line: 868  
Char: 3  
Error: ‘down( )’ is null or not an object  
…  
…

But the above code works fine if o replace Effect.toggle… by  
Element.toggle… I have downloaded all the latest files  
from [script.aculo.us](http://script.aculo.us)

Plz let me know what is happening…

---

<div class="post-metadata">

**Author:** ![jagdishSRubin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d6d6ee/32.png) [@jagdishSRubin](https://www.ruby-forum.com/u/jagdishSRubin)\
**Post date:** [May 20, 2008, 3:28pm UTC](https://www.ruby-forum.com/t/problem-while-using-effect-toggle/138135/2 "2008-05-20T15:28:34Z")

</div>

On 20 May 2008, at 14:03, jagdish-------Rubindasss wrote:

> Hi I’m new in rails…I have a problem plz help me…
> 
> I’m using Effect.toggle in my code. But it is not working…My code  
> is like this…
> 
> \<%=link\_to\_function “Toggle this”, onClick=“Effect.toggle( ‘ddiv’,  
> ‘slide’ ); return flase;”%\>

That should be

> \<%=link\_to\_function “Toggle this”, “new Effect.toggle( ‘ddiv’,  
> ‘slide’ )”%\>

effects are always ran by instantiating a new instance of the effect  
object. On top of that some effects require that the element you’re  
working on have a child element. This can be as simple as an empty span.

Fred

---

<div class="post-metadata">

**Author:** ![jagdishSRubin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d6d6ee/32.png) [@jagdishSRubin](https://www.ruby-forum.com/u/jagdishSRubin)\
**Post date:** [May 21, 2008, 9:20am UTC](https://www.ruby-forum.com/t/problem-while-using-effect-toggle/138135/3 "2008-05-21T09:20:39Z")

</div>

Hi Fred thanks for your reply. But I have already done as your  
suggestion like

\<%=link\_to\_function “Toggle this”, “new Effect.toggle( ‘ddiv’,  
‘slide’ )”%\>  
…  
…

But still it doesn’t work. The same problem occurs…Plz help me to  
get rid of this…

—jagdish

On May 20, 6:27 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![jagdishSRubin](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/d6d6ee/32.png) [@jagdishSRubin](https://www.ruby-forum.com/u/jagdishSRubin)\
**Post date:** [May 21, 2008, 9:42am UTC](https://www.ruby-forum.com/t/problem-while-using-effect-toggle/138135/4 "2008-05-21T09:42:21Z")

</div>

On 21 May 2008, at 08:19, jagdish-------Rubindasss wrote:

> get rid of this…  
> See second part of my previous suggestion.

Fred
