> first-child
Doh!!
-- T.J. ;-)
On Nov 21, 6:06 pm, Matt Foster <[EMAIL PROTECTED]> wrote:
> var textFromTD = $("search").select("tr td:first-child").pluck
> ("innerHTML");
>
> On Nov 21, 12:32 pm, Jay <[EMAIL PROTECTED]> wrote:
>
> > another idea, you might try selectors -
>
> > a) if you can put a class on the td cells you are interested in, call
> > the class cell1 for instance <td class="cell1">, then reference it
> > with
>
> > $$('#search tbody tr td.cell1').each(function(e){ ...
> > e.innerHTML ...});
>
> > b) as SWilk said use nth-child, but employing $$ to save a bit of
> > clutter
>
> > $$('#search tbody tr > td:nth-child(1)').each(function(e){ ...
> > e.innerHTML ...});
>
> > --Jay
>
> > On Nov 20, 7:18 pm, 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 [email protected]
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
-~----------~----~----~----~------~----~------~--~---