var y = $$('span.hello').pluck('innerHTML');

You don't have to declare an empty array first.

Visit the API page for pluck [1] and spend some time with the
Enumerable methods (they take a while to grok).

Cheers,
Andrew

[1] http://prototypejs.org/api/enumerable/pluck

On May 3, 6:54 pm, Andrew <[EMAIL PROTECTED]> wrote:
> hey if anyone can help i'd really appreciate it.
>
> im relatively new to prototype, and it's already eliminated at least
> 75 percent of my code so i've quickly become an enormous fan.  it's
> also allowed me to do things i never would have figured out without
> it.
>
> i was working on the following problem couldn't figure it out.
>
> ive got a bunch of elements with tag 'span' and class 'hello''.  i
> want to get the innerHTML (dont care if i use .innerHTML) from each
> element in the page and put it in an array.  i've made many attempts,
> yet always seem to get errors.
>
> also elements dont have ids which is the source of the problem.
> unfortunately i don't have access to the server side which generates
> the output im trying to manipulate so i cannot add an id.
>
> var y = new Array();
> y = $$('span.hello').innerHTML;
>
> seems to be my most logical attempt, but it doesnt work
--~--~---------~--~----~------------~-------~--~----~
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@googlegroups.com
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to