Forum: Ruby on Rails Simple Toggle Question

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
7813d26c8ef483e08432ec9c574664d6?d=identicon&s=25 Ben (Guest)
on 2006-05-04 00:27
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')") %>
<div id="furtherinfo">
  <p>Hidden by default, hopefully.</p>
</div>

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

Any ideas?

Thanks.
8540479bbacb4ab1bc5f6c6e13f90094?d=identicon&s=25 unknown (Guest)
on 2006-05-04 00:44
(Received via mailing list)
Do you have a typo, dislplay instead of display in the furtherinfo
section?

Stephan
7813d26c8ef483e08432ec9c574664d6?d=identicon&s=25 Ben (Guest)
on 2006-05-04 01:16
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.
6076c22b65b36f5d75c30bdcfb2fda85?d=identicon&s=25 Ezra Zygmuntowicz (Guest)
on 2006-05-04 02:07
(Received via mailing list)
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.

<div id='whatever' style='display: none;'></div>

-Ezra
7813d26c8ef483e08432ec9c574664d6?d=identicon&s=25 Ben (Guest)
on 2006-05-04 02:15
Thanks Ezra, that did the trick.
This topic is locked and can not be replied to.