$ 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 <[EMAIL PROTECTED]> 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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---