Hi, i want to use the $ utility function select all elements with an id that starts with ''select_''. I know you can basic regex with the $function..so in this case i''d need to use the carat to search for id''s starting with ''list_''. I cannot find the correct syntax to do this in the manual....i''ve tried every way i can think of...it has to be something like $(^''select_'') Any ideas? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
$ only selects one element with an id equal to the string you pass (if
you pass anything that''s not a string, then it returns the same thing
you passed), it does not accept a RegExp to search elements whose id
match it. But you can use $$, which accepts any CSS3 selector and
returns the list of all elements that match. And CSS3 lets you match
elements with an attribute that  "starts with ..." something by doing
$$("[id^=select_]")
http://prototypejs.org/api/utility/dollar-dollar
http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors
Best,
-Nicolas
On Jan 25, 2008 9:40 PM, elduderino
<jamesfiltness-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>
wrote:>
> Hi, i want to use the $ utility function select all elements with an
> id that starts with ''select_''. I know you can basic regex
with the
> $function..so in this case i''d need to use the carat to search for
> id''s starting with ''list_''. I cannot find the
correct syntax to do
> this in the manual....i''ve tried every way i can think of...it has
to
> be something like $(^''select_'')
>
> Any ideas?
>
> Thanks
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
Hi Nicolas, thanks for the info....so if i''m using css3 selectors from within my $$ function is it still going to be cross browser? thanks On Jan 25, 11:54 pm, "Nicolás Sanguinetti" <godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> $ only selects one element with an id equal to the string you pass (if > you pass anything that''s not a string, then it returns the same thing > you passed), it does not accept a RegExp to search elements whose id > match it. But you can use $$, which accepts any CSS3 selector and > returns the list of all elements that match. And CSS3 lets you match > elements with an attribute that "starts with ..." something by doing > > $$("[id^=select_]") > > http://prototypejs.org/api/utility/dollar-dollarhttp://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors > > Best, > -Nicolas > > On Jan 25, 2008 9:40 PM, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > Hi, i want to use the $ utility function select all elements with an > > id that starts with ''select_''. I know you can basic regex with the > > $function..so in this case i''d need to use the carat to search for > > id''s starting with ''list_''. I cannot find the correct syntax to do > > this in the manual....i''ve tried every way i can think of...it has to > > be something like $(^''select_'') > > > Any ideas? > > > Thanks--~--~---------~--~----~------------~-------~--~----~ 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 selectors are implemented in JS, not native browser CSS, so select away! On 1/25/08, elduderino <jamesfiltness-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> > Hi Nicolas, thanks for the info....so if i''m using css3 selectors from > within my $$ function is it still going to be cross browser? > > thanks > > On Jan 25, 11:54 pm, "Nicolás Sanguinetti" <godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > $ only selects one element with an id equal to the string you pass (if > > you pass anything that''s not a string, then it returns the same thing > > you passed), it does not accept a RegExp to search elements whose id > > match it. But you can use $$, which accepts any CSS3 selector and > > returns the list of all elements that match. And CSS3 lets you match > > elements with an attribute that "starts with ..." something by doing > > > > $$("[id^=select_]") > > > > http://prototypejs.org/api/utility/dollar-dollarhttp://www.w3.org/TR/2001/CR-css3-selectors-20011113/#selectors > > > > Best, > > -Nicolas > > > > On Jan 25, 2008 9:40 PM, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > > > > > Hi, i want to use the $ utility function select all elements with an > > > id that starts with ''select_''. I know you can basic regex with the > > > $function..so in this case i''d need to use the carat to search for > > > id''s starting with ''list_''. I cannot find the correct syntax to do > > > this in the manual....i''ve tried every way i can think of...it has to > > > be something like $(^''select_'') > > > > > Any ideas? > > > > > Thanks > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
oh my god..that''s sick. Prototype is amazing! On Jan 26, 12:32 am, "Andrew Kaspick" <akasp...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> The selectors are implemented in JS, not native browser CSS, so select away! > > On 1/25/08, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > Hi Nicolas, thanks for the info....so if i''m using css3 selectors from > > within my $$ function is it still going to be cross browser? > > > thanks > > > On Jan 25, 11:54 pm, "Nicolás Sanguinetti" <godf...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > $ only selects one element with an id equal to the string you pass (if > > > you pass anything that''s not a string, then it returns the same thing > > > you passed), it does not accept a RegExp to search elements whose id > > > match it. But you can use $$, which accepts any CSS3 selector and > > > returns the list of all elements that match. And CSS3 lets you match > > > elements with an attribute that "starts with ..." something by doing > > > > $$("[id^=select_]") > > > >http://prototypejs.org/api/utility/dollar-dollarhttp://www.w3.org/TR/... > > > > Best, > > > -Nicolas > > > > On Jan 25, 2008 9:40 PM, elduderino <jamesfiltn...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: > > > > > Hi, i want to use the $ utility function select all elements with an > > > > id that starts with ''select_''. I know you can basic regex with the > > > > $function..so in this case i''d need to use the carat to search for > > > > id''s starting with ''list_''. I cannot find the correct syntax to do > > > > this in the manual....i''ve tried every way i can think of...it has to > > > > be something like $(^''select_'') > > > > > Any ideas? > > > > > Thanks--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---