TY muchly

----- Original Message ----- 
From: "Szymon Wilkołazki" <wilkola...@gmail.com>
To: <prototype-scriptaculous@googlegroups.com>
Sent: Friday, June 05, 2009 11:33 AM
Subject: [Proto-Scripty] Re: Last table row

> Jeztah wrote:
>> Morning...
>> Very silly and easy question but my brain isn't working today....
>> How can i get the last row of a table (table id="foo") ...
>> The row is inserted dynamically via an ajax request so its not on the
>> page at load time!.
>> $('foo').select('tr:last');
> Unlike jQuery, Prototype.js uses standard CSS selectors only.
> Try
> $$('#foo>tr:last-child');
> Why $$('#foo') and not $('foo').select()?
> If you had some nested tables inside table#foo, then the select clause
> would return last rows of each of those nested tables along with the
> last row of foo table.
> Please also take note, that if you have tbody, thead or tfoot elements
> in the table then you will get one tr per each of that elements.
> Even if you have not tbody in your html, current browsers might create
> one dynamically for you, in the process of html error correction.
> This, however, should not be a problem since ther would be only one
> tbody for the table.
> If you have more than one tbody, then try this:
> $$('#foo>tbody:last-child>tr:last-child');
> If you have also a tfoot, then use tfoot in the above.
> Best regards,
> SWilk
> >

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 
For more options, visit this group at 

Reply via email to