# Simple Toggle Question

**URL:** <https://www.ruby-forum.com/t/simple-toggle-question/59542>\
**Category:** Rails\
**Created:** [May 4, 2006, 12:27am UTC](https://www.ruby-forum.com/t/simple-toggle-question/59542 "2006-05-04T00:27:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 4, 2006, 12:27am UTC](https://www.ruby-forum.com/t/simple-toggle-question/59542/1 "2006-05-04T00:27:20Z")

</div>

I’m having trouble with the toggle() function from prototype.

Basically I want the element hidden by default, and I can’t seem to do  
it.

My code:

The CSS:

#furtherinfo {  
dislplay: none;  
}

The View:

\<%= link\_to\_function(‘Further Information’,  
“Element.toggle(‘furtherinfo’)”) %\>

Hidden by default, hopefully.

It works fine when I don’t have the css, but then it displays #details  
by default.

Any ideas?

Thanks.

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 4, 2006, 12:44am UTC](https://www.ruby-forum.com/t/simple-toggle-question/59542/2 "2006-05-04T00:44:53Z")

</div>

Do you have a typo, dislplay instead of display in the furtherinfo  
section?

Stephan

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 4, 2006, 2:07am UTC](https://www.ruby-forum.com/t/simple-toggle-question/59542/3 "2006-05-04T02:07:02Z")

</div>

On May 3, 2006, at 3:27 PM, Ben wrote:

> dislplay: none;  
> It works fine when I don’t have the css, but then it displays #details  
> by default.
> 
> Any ideas?
> 
> Thanks.

When I use the toggle and want the div to first appear hidden, I find  
that I need to put the display: none in the div itself.

-Ezra

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 4, 2006, 1:16am UTC](https://www.ruby-forum.com/t/simple-toggle-question/59542/4 "2006-05-04T01:16:29Z")

</div>

unknown wrote:

> Do you have a typo, dislplay instead of display in the furtherinfo  
> section?
> 
> Stephan

I guess I did in my example, but not in my actual app. Thanks though.

---

<div class="post-metadata">

**Author:** ![ben](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/df788c/32.png) [@ben](https://www.ruby-forum.com/u/ben)\
**Post date:** [May 4, 2006, 2:15am UTC](https://www.ruby-forum.com/t/simple-toggle-question/59542/5 "2006-05-04T02:15:13Z")

</div>

Thanks Ezra, that did the trick.
