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.
--
Posted via http://www.ruby-forum.com/.
Do you have a typo, dislplay instead of display in the furtherinfo section? Stephan On Thu, May 04, 2006 at 12:27:20AM +0200, Ben wrote:> 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. > > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails
unknown wrote:> Do you have a typo, dislplay instead of display in the furtherinfo > section? > > StephanI guess I did in my example, but not in my actual app. Thanks though. -- Posted via http://www.ruby-forum.com/.
On May 3, 2006, at 3:27 PM, Ben wrote:> 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.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