Hi, I'd think CSS3 "nth-child" selectors[1] should be able to help (not with the unique bit). Something like this:
list = $('search').down('tbody').select('tr > td:nth-child(1)'); list.each(function(td) { // ...do something with the td here... */ }); There I used a direct child selector (the > bit) just in case you have nested tables. That should match the first cell in each row of the table's (first) tbody. You can have multiple tbody elements in a table, if so you'll have to handle that separately. [1] http://www.w3.org/TR/css3-selectors/#nth-child-pseudo HTH, -- T.J. Crowder tj / crowder software / com On Nov 21, 12:18 am, Jlopez <[EMAIL PROTECTED]> wrote: > Hi, > > I'm trying to get the text from the first <TD> of every <TR> in the > <TBODY> of my table. > To make it trickier I also would lke unique items. > > This is what I have so far that works, but I feel like there should be > a cleaner way of doing it. > > My table id is 'search' > I want to dump the contents into a div named 'distinct' > > var events = new Array(); > var rows2 = $('search').down('tbody').childElements(); > > rows2.each( > function(e) { > > if (e.down('td').down('a').innerHTML.toLowerCase().include > (sk.toLowerCase())) > { > events.push(e.down('td').down('a').innerHTML); > } > } > ); > > rows2.clear(); > > events.uniq().each(function(e) { > $('distinct').insert(e); > }); > > events.clear(); > > Thanks, > Joel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---