Let''s say I have the following html tags: <table> <tr> <td id="id1">HelloWorld</td> <td id="id2">HelloWorld2</td> </tr> <tr> <td id="id3">HelloWorld3</td> <td id="id4">HelloWorld4</td> </tr> </table> How can I use prototype to retrive all the cell value, is it possible? Thank you! --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
$$(''table td'').pluck(''innerHTML''); //=> [''HelloWorld'', ''HelloWorld2'', ''HelloWorld3'', ''HelloWorld4''] --~--~---------~--~----~------------~-------~--~----~ 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 Kangax, can I use ID to call the table, example $$(''mytable td'').pluck(''innerHTML''); , I retrieve nothing! <table id="mytable"> <tr> <td id="id1">HelloWorld</td> <td id="id2">HelloWorld2</td> </tr> <tr> <td id="id3">HelloWorld3</td> <td id="id4">HelloWorld4</td> </tr> </table> On Nov 5, 12:07 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> $$(''table td'').pluck(''innerHTML''); //=> [''HelloWorld'', ''HelloWorld2'', > ''HelloWorld3'', ''HelloWorld4'']--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Yes, you can. $$ takes any (well, almost any) valid css3 selector and returns matching collection. In this case what you want is $$(''#mytable td'').pluck( ... ) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You need to reference the ID in CSS syntax format, preceded by the hash symbol, as Kangax has demonstrated above.. $$(''#mytable td'').pluck( ... ) On Nov 5, 9:24 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Yes, you can. > $$ takes any (well, almost any) valid css3 selector and returns > matching collection. > In this case what you want is $$(''#mytable td'').pluck( ... )--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Thank you kangax and matt! alert($$(''#mytable td'').pluck(''innerHTML'')); won''t work!? for me! On Nov 5, 9:24 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Yes, you can. > $$ takes any (well, almost any) valid css3 selector and returns > matching collection. > In this case what you want is $$(''#mytable td'').pluck( ... )--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I can''t find reference to the pluck method in prototyps api page On Nov 5, 2007 5:03 PM, kelvin <tan.kah.wooi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > Thank you kangax and matt! > > alert($$(''#mytable td'').pluck(''innerHTML'')); won''t work!? for me! > > On Nov 5, 9:24 am, kangax <kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Yes, you can. > > $$ takes any (well, almost any) valid css3 selector and returns > > matching collection. > > In this case what you want is $$(''#mytable td'').pluck( ... ) > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
http://www.prototypejs.org/api/enumerable/pluck --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
http://prototypejs.org/api/enumerable/pluck It''s part of the Enumerable mixin. TAG On Nov 5, 2007, at 10:11 AM, Antonio CS wrote:> I can''t find reference to the pluck method in prototyps api page > > On Nov 5, 2007 5:03 PM, kelvin <tan.kah.wooi-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Thank you kangax and matt! > > alert($$(''#mytable td'').pluck(''innerHTML'')); won''t work!? for me! > > On Nov 5, 9:24 am, kangax < kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Yes, you can. > > $$ takes any (well, almost any) valid css3 selector and returns > > matching collection. > > In this case what you want is $$(''#mytable td'').pluck( ... ) > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I think because the table is presented using <div>, could it be the reason? On Nov 5, 12:46 pm, Tom Gregory <t...-PGZyUNKar/Q@public.gmane.org> wrote:> http://prototypejs.org/api/enumerable/pluck > > It''s part of the Enumerable mixin. > > TAG > > On Nov 5, 2007, at 10:11 AM, Antonio CS wrote: > > > I can''t find reference to the pluck method in prototyps api page > > > On Nov 5, 2007 5:03 PM, kelvin <tan.kah.w...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Thank you kangax and matt! > > > alert($$(''#mytable td'').pluck(''innerHTML'')); won''t work!? for me! > > > On Nov 5, 9:24 am, kangax < kan...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Yes, you can. > > > $$ takes any (well, almost any) valid css3 selector and returns > > > matching collection. > > > In this case what you want is $$(''#mytable td'').pluck( ... )--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---