ok i am brand new to prototype (i am used to using jquery). i have a
div with a class of "search" and i would like to make it so that when
a link is clicked, the div''s visibility will toggle (if its hidden it
will be shown, if it is visible it will hide).
so i was thinking that in the onClick attribute of the a tag i would
put a simple statement like $(''.search'').toggle but that is
the
jquery way. looking through some tutorials for prototype it looks
like it would have to be more like this:
allNodes = document.getElementsByClassName("search");
for(i = 0; i < allNodes.length; i++) {
allNodes[i].toggle();
}
but from what i am seeing, i would also need to include scriptaculous
to get the toggle functionality is that correct?
and this seems like a lot of code (compared to jQuery) just to get a
div to toggle. am i missing something? is there a quicker way?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
ok so i just found this page: http://www.prototypejs.org/api/element/toggle but i am still confused: 1) do i need scriptaculous to get toggle functionality or do i get by just including prototype.js? 2) it says that it will not show divs that were hidden via css?! how else would i hide a div? if i want the div to be hidden when the page loads, and then toggled when a link is clicked, how woudl i do that if i cant set the css for the div to display:none ?? On Nov 27, 2:46 pm, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> ok i am brand new to prototype (i am used to using jquery). i have a > div with a class of "search" and i would like to make it so that when > a link is clicked, the div''s visibility will toggle (if its hidden it > will be shown, if it is visible it will hide). > > so i was thinking that in the onClick attribute of the a tag i would > put a simple statement like $(''.search'').toggle but that is the > jquery way. looking through some tutorials for prototype it looks > like it would have to be more like this: > > allNodes = document.getElementsByClassName("search"); > for(i = 0; i < allNodes.length; i++) { > allNodes[i].toggle(); > > } > > but from what i am seeing, i would also need to include scriptaculous > to get the toggle functionality is that correct? > > and this seems like a lot of code (compared to jQuery) just to get a > div to toggle. am i missing something? is there a quicker way?--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
the css declaration displa:none got to be inline
<div id="capa" style="display:none"></div>
and in your js put
$(''capa'').toggle();
this make that your div shows
its from the example see the code
On Nov 27, 2007 1:53 PM, bdee1
<blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> ok so i just found this page:
> http://www.prototypejs.org/api/element/toggle
>
> but i am still confused:
> 1) do i need scriptaculous to get toggle functionality or do i get by
> just including prototype.js?
> 2) it says that it will not show divs that were hidden via css?! how
> else would i hide a div? if i want the div to be hidden when the page
> loads, and then toggled when a link is clicked, how woudl i do that if
> i cant set the css for the div to display:none ??
>
> On Nov 27, 2:46 pm, bdee1
<blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > ok i am brand new to prototype (i am used to using jquery). i have a
> > div with a class of "search" and i would like to make it so
that when
> > a link is clicked, the div''s visibility will toggle (if its
hidden it
> > will be shown, if it is visible it will hide).
> >
> > so i was thinking that in the onClick attribute of the a tag i would
> > put a simple statement like $(''.search'').toggle but
that is the
> > jquery way. looking through some tutorials for prototype it looks
> > like it would have to be more like this:
> >
> > allNodes = document.getElementsByClassName("search");
> > for(i = 0; i < allNodes.length; i++) {
> > allNodes[i].toggle();
> >
> > }
> >
> > but from what i am seeing, i would also need to include scriptaculous
> > to get the toggle functionality is that correct?
> >
> > and this seems like a lot of code (compared to jQuery) just to get a
> > div to toggle. am i missing something? is there a quicker way?
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
and prototype gives you this behavior scriptaculus it''s not necesary On Nov 27, 2007 1:59 PM, Elden <willy.d7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> the css declaration displa:none got to be inline > > <div id="capa" style="display:none"></div> > > and in your js put > > $(''capa'').toggle(); > > this make that your div shows > > its from the example see the code > > > On Nov 27, 2007 1:53 PM, bdee1 <blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > ok so i just found this page: > > http://www.prototypejs.org/api/element/toggle > > > > but i am still confused: > > 1) do i need scriptaculous to get toggle functionality or do i get by > > just including prototype.js? > > 2) it says that it will not show divs that were hidden via css?! how > > else would i hide a div? if i want the div to be hidden when the page > > loads, and then toggled when a link is clicked, how woudl i do that if > > i cant set the css for the div to display:none ?? > > > > On Nov 27, 2:46 pm, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > ok i am brand new to prototype (i am used to using jquery). i have a > > > div with a class of "search" and i would like to make it so that when > > > a link is clicked, the div''s visibility will toggle (if its hidden it > > > will be shown, if it is visible it will hide). > > > > > > so i was thinking that in the onClick attribute of the a tag i would > > > put a simple statement like $(''.search'').toggle but that is the > > > jquery way. looking through some tutorials for prototype it looks > > > like it would have to be more like this: > > > > > > allNodes = document.getElementsByClassName("search"); > > > for(i = 0; i < allNodes.length; i++) { > > > allNodes[i].toggle(); > > > > > > } > > > > > > but from what i am seeing, i would also need to include scriptaculous > > > to get the toggle functionality is that correct? > > > > > > and this seems like a lot of code (compared to jQuery) just to get a > > > div to toggle. am i missing something? is there a quicker way? > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Nicolás Sanguinetti
2007-Nov-27 20:02 UTC
Re: setting a div to toggle when a link is clicked
$$(".search").invoke("toggle");
$ selects an element by id, $$ by CSS selector. When you have a
collection, and want to call methods on the entire collection, invoke
is your friend. http://prototypejs.org/api/enumerable/invoke
See http://thinkweb2.com/projects/prototype-checklist/ for a few good
practices that will ease hte transition from jQuery :)
Best,
-foca
On Nov 27, 2007 6:00 PM, Elden
<willy.d7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> and prototype gives you this behavior scriptaculus it''s not
necesary
>
> On Nov 27, 2007 1:59 PM, Elden
<willy.d7-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > the css declaration displa:none got to be inline
> >
> > <div id="capa"
style="display:none"></div>
> >
> > and in your js put
> >
> > $(''capa'').toggle();
> >
> > this make that your div shows
> >
> > its from the example see the code
> >
> >
> >
> >
> >
> >
> >
> >
> > On Nov 27, 2007 1:53 PM, bdee1
<blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote:
> >
> > >
> > > ok so i just found this page:
> > > http://www.prototypejs.org/api/element/toggle
> > >
> > > but i am still confused:
> > > 1) do i need scriptaculous to get toggle functionality or do i
get by
> > > just including prototype.js?
> > > 2) it says that it will not show divs that were hidden via css?!
how
> > > else would i hide a div? if i want the div to be hidden when the
page
> > > loads, and then toggled when a link is clicked, how woudl i do
that if
> > > i cant set the css for the div to display:none ??
> > >
> > >
> > >
> > >
> > > On Nov 27, 2:46 pm, bdee1
<blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > > ok i am brand new to prototype (i am used to using jquery).
i have a
> > > > div with a class of "search" and i would like to
make it so that when
> > > > a link is clicked, the div''s visibility will toggle
(if its hidden it
> > > > will be shown, if it is visible it will hide).
> > > >
> > > > so i was thinking that in the onClick attribute of the a tag
i would
> > > > put a simple statement like
$(''.search'').toggle but that is the
> > > > jquery way. looking through some tutorials for prototype it
looks
> > > > like it would have to be more like this:
> > > >
> > > > allNodes =
document.getElementsByClassName("search");
> > > > for(i = 0; i < allNodes.length; i++) {
> > > > allNodes[i].toggle();
> > > >
> > > > }
> > > >
> > > > but from what i am seeing, i would also need to include
scriptaculous
> > > > to get the toggle functionality is that correct?
> > > >
> > > > and this seems like a lot of code (compared to jQuery) just
to get a
> > > > div to toggle. am i missing something? is there a quicker
way?
> > >
> >
> >
> > > >
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
ok so thats good to know - i just need scriptaculous.
now i have been digging through the prototype API documentation and
found the $$ function.
so i tried this:
onclick="$$(''.search'').toggle();"
but i get the following error:
$$(".search").toggle is not a function
what did i do wrong?
On Nov 27, 3:00 pm, Elden
<willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> and prototype gives you this behavior scriptaculus it''s not
necesary
>
> On Nov 27, 2007 1:59 PM, Elden
<willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
>
>
> > the css declaration displa:none got to be inline
>
> > <div id="capa"
style="display:none"></div>
>
> > and in your js put
>
> > $(''capa'').toggle();
>
> > this make that your div shows
>
> > its from the example see the code
>
> > On Nov 27, 2007 1:53 PM, bdee1
<blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
>
> > > ok so i just found this page:
> > >http://www.prototypejs.org/api/element/toggle
>
> > > but i am still confused:
> > > 1) do i need scriptaculous to get toggle functionality or do i
get by
> > > just including prototype.js?
> > > 2) it says that it will not show divs that were hidden via css?!
how
> > > else would i hide a div? if i want the div to be hidden when the
page
> > > loads, and then toggled when a link is clicked, how woudl i do
that if
> > > i cant set the css for the div to display:none ??
>
> > > On Nov 27, 2:46 pm, bdee1
<blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > > ok i am brand new to prototype (i am used to using jquery).
i have a
> > > > div with a class of "search" and i would like to
make it so that when
> > > > a link is clicked, the div''s visibility will toggle
(if its hidden it
> > > > will be shown, if it is visible it will hide).
>
> > > > so i was thinking that in the onClick attribute of the a tag
i would
> > > > put a simple statement like
$(''.search'').toggle but that is the
> > > > jquery way. looking through some tutorials for prototype it
looks
> > > > like it would have to be more like this:
>
> > > > allNodes =
document.getElementsByClassName("search");
> > > > for(i = 0; i < allNodes.length; i++) {
> > > > allNodes[i].toggle();
>
> > > > }
>
> > > > but from what i am seeing, i would also need to include
scriptaculous
> > > > to get the toggle functionality is that correct?
>
> > > > and this seems like a lot of code (compared to jQuery) just
to get a
> > > > div to toggle. am i missing something? is there a quicker
way?- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
very helpful - thank you! now heres another question... in jquery there is a function called slideToggle(). that will apply a toggle but when showign the div it will slide it down, and when hiding it it will slide it up: http://docs.jquery.com/Effects/slideToggle is there somethgin similar in scriptaculous that i could use to achieve the same effect? On Nov 27, 3:02 pm, "Nicolás Sanguinetti" <godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> $$(".search").invoke("toggle"); > > $ selects an element by id, $$ by CSS selector. When you have a > collection, and want to call methods on the entire collection, invoke > is your friend.http://prototypejs.org/api/enumerable/invoke > > Seehttp://thinkweb2.com/projects/prototype-checklist/for a few good > practices that will ease hte transition from jQuery :) > > Best, > -foca > > On Nov 27, 2007 6:00 PM, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > and prototype gives you this behavior scriptaculus it''s not necesary > > > On Nov 27, 2007 1:59 PM, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > the css declaration displa:none got to be inline > > > > <div id="capa" style="display:none"></div> > > > > and in your js put > > > > $(''capa'').toggle(); > > > > this make that your div shows > > > > its from the example see the code > > > > On Nov 27, 2007 1:53 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > wrote: > > > > > ok so i just found this page: > > > >http://www.prototypejs.org/api/element/toggle > > > > > but i am still confused: > > > > 1) do i need scriptaculous to get toggle functionality or do i get by > > > > just including prototype.js? > > > > 2) it says that it will not show divs that were hidden via css?! how > > > > else would i hide a div? if i want the div to be hidden when the page > > > > loads, and then toggled when a link is clicked, how woudl i do that if > > > > i cant set the css for the div to display:none ?? > > > > > On Nov 27, 2:46 pm, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > ok i am brand new to prototype (i am used to using jquery). i have a > > > > > div with a class of "search" and i would like to make it so that when > > > > > a link is clicked, the div''s visibility will toggle (if its hidden it > > > > > will be shown, if it is visible it will hide). > > > > > > so i was thinking that in the onClick attribute of the a tag i would > > > > > put a simple statement like $(''.search'').toggle but that is the > > > > > jquery way. looking through some tutorials for prototype it looks > > > > > like it would have to be more like this: > > > > > > allNodes = document.getElementsByClassName("search"); > > > > > for(i = 0; i < allNodes.length; i++) { > > > > > allNodes[i].toggle(); > > > > > > } > > > > > > but from what i am seeing, i would also need to include scriptaculous > > > > > to get the toggle functionality is that correct? > > > > > > and this seems like a lot of code (compared to jQuery) just to get a > > > > > div to toggle. am i missing something? is there a quicker way?- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Nov 27, 2007, at 1:04 PM, bdee1 wrote:> > ok so thats good to know - i just need scriptaculous. > > now i have been digging through the prototype API documentation and > found the $$ function. > > so i tried this: > onclick="$$(''.search'').toggle();" > > but i get the following error: > $$(".search").toggle is not a function > > what did i do wrong?$$() returns an array. Toggle works on elements. Like a previous poster suggested, use invoke("toggle"), which will toggle each of the elements in the array... that may not be quite what you want. TAG --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Nicolás Sanguinetti
2007-Nov-27 20:13 UTC
Re: setting a div to toggle when a link is clicked
If you want to use effects, *then* you need script.aculo.us
"effects.js" script.
$$(".search).each(function(d) { Effect.toggle(d, ''blind'')
});
should do it :) ( http://wiki.script.aculo.us/scriptaculous/show/Effect.toggle )
Best,
-Nicolas
On Nov 27, 2007 6:04 PM, bdee1
<blairdee2000-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> ok so thats good to know - i just need scriptaculous.
>
> now i have been digging through the prototype API documentation and
> found the $$ function.
>
> so i tried this:
> onclick="$$(''.search'').toggle();"
>
> but i get the following error:
> $$(".search").toggle is not a function
>
> what did i do wrong?
>
> On Nov 27, 3:00 pm, Elden
<willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > and prototype gives you this behavior scriptaculus it''s not
necesary
> >
> > On Nov 27, 2007 1:59 PM, Elden
<willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> >
> >
> > > the css declaration displa:none got to be inline
> >
> > > <div id="capa"
style="display:none"></div>
> >
> > > and in your js put
> >
> > > $(''capa'').toggle();
> >
> > > this make that your div shows
> >
> > > its from the example see the code
> >
>
> > > On Nov 27, 2007 1:53 PM, bdee1
<blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> >
> > > > ok so i just found this page:
> > > >http://www.prototypejs.org/api/element/toggle
> >
> > > > but i am still confused:
> > > > 1) do i need scriptaculous to get toggle functionality or do
i get by
> > > > just including prototype.js?
> > > > 2) it says that it will not show divs that were hidden via
css?! how
> > > > else would i hide a div? if i want the div to be hidden
when the page
> > > > loads, and then toggled when a link is clicked, how woudl i
do that if
> > > > i cant set the css for the div to display:none ??
> >
> > > > On Nov 27, 2:46 pm, bdee1
<blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> > > > > ok i am brand new to prototype (i am used to using
jquery). i have a
> > > > > div with a class of "search" and i would like
to make it so that when
> > > > > a link is clicked, the div''s visibility will
toggle (if its hidden it
> > > > > will be shown, if it is visible it will hide).
> >
> > > > > so i was thinking that in the onClick attribute of the
a tag i would
> > > > > put a simple statement like
$(''.search'').toggle but that is the
> > > > > jquery way. looking through some tutorials for
prototype it looks
> > > > > like it would have to be more like this:
> >
> > > > > allNodes =
document.getElementsByClassName("search");
> > > > > for(i = 0; i < allNodes.length; i++) {
> > > > > allNodes[i].toggle();
> >
> > > > > }
> >
> > > > > but from what i am seeing, i would also need to include
scriptaculous
> > > > > to get the toggle functionality is that correct?
> >
> > > > > and this seems like a lot of code (compared to jQuery)
just to get a
> > > > > div to toggle. am i missing something? is there a
quicker way?- Hide quoted text -
> >
> > - Show quoted text -
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to
rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---
thanks, i''ll give that a shot. i just have to figure out how to include effects.js given my CMS scenario over in my other thread: http://groups.google.com/group/rubyonrails-spinoffs/browse_thread/thread/e3aafb15124f2b75 On Nov 27, 3:13 pm, "Nicolás Sanguinetti" <godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> If you want to use effects, *then* you need script.aculo.us "effects.js" script. > > $$(".search).each(function(d) { Effect.toggle(d, ''blind'') }); > > should do it :) (http://wiki.script.aculo.us/scriptaculous/show/Effect.toggle) > > Best, > -Nicolas > > On Nov 27, 2007 6:04 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > ok so thats good to know - i just need scriptaculous. > > > now i have been digging through the prototype API documentation and > > found the $$ function. > > > so i tried this: > > onclick="$$(''.search'').toggle();" > > > but i get the following error: > > $$(".search").toggle is not a function > > > what did i do wrong? > > > On Nov 27, 3:00 pm, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > and prototype gives you this behavior scriptaculus it''s not necesary > > > > On Nov 27, 2007 1:59 PM, Elden <willy...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > the css declaration displa:none got to be inline > > > > > <div id="capa" style="display:none"></div> > > > > > and in your js put > > > > > $(''capa'').toggle(); > > > > > this make that your div shows > > > > > its from the example see the code > > > > > On Nov 27, 2007 1:53 PM, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > ok so i just found this page: > > > > >http://www.prototypejs.org/api/element/toggle > > > > > > but i am still confused: > > > > > 1) do i need scriptaculous to get toggle functionality or do i get by > > > > > just including prototype.js? > > > > > 2) it says that it will not show divs that were hidden via css?! how > > > > > else would i hide a div? if i want the div to be hidden when the page > > > > > loads, and then toggled when a link is clicked, how woudl i do that if > > > > > i cant set the css for the div to display:none ?? > > > > > > On Nov 27, 2:46 pm, bdee1 <blairdee2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > ok i am brand new to prototype (i am used to using jquery). i have a > > > > > > div with a class of "search" and i would like to make it so that when > > > > > > a link is clicked, the div''s visibility will toggle (if its hidden it > > > > > > will be shown, if it is visible it will hide). > > > > > > > so i was thinking that in the onClick attribute of the a tag i would > > > > > > put a simple statement like $(''.search'').toggle but that is the > > > > > > jquery way. looking through some tutorials for prototype it looks > > > > > > like it would have to be more like this: > > > > > > > allNodes = document.getElementsByClassName("search"); > > > > > > for(i = 0; i < allNodes.length; i++) { > > > > > > allNodes[i].toggle(); > > > > > > > } > > > > > > > but from what i am seeing, i would also need to include scriptaculous > > > > > > to get the toggle functionality is that correct? > > > > > > > and this seems like a lot of code (compared to jQuery) just to get a > > > > > > div to toggle. am i missing something? is there a quicker way?- Hide quoted text - > > > > - Show quoted text -- Hide quoted text - > > - Show quoted text ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---