So you are saying you want the entire last row of the outer table, not the
last row of the inner table, is that right? IOW, what you want to get back
is this row:

<tr><td>test</td><td><table><tbody><tr><td>New
test</td></tr></tbody></table></td></tr>

If that's right, you're just missing a '>' in your selector. Change it from:

var $row = $('table#list tbody>tr:last');

to:

var $row = $('table#list>tbody>tr:last');

Even better would be:

var $row = $('#list>tbody>tr:last');

There's no benefit to specifying 'table' on the selector since the table has
an ID - it may actually be faster if you just use the ID alone.

Also I assume that the difference in ID ('list' in the selector, 'mytable'
in the HTML) is just a typo.

-Mike

On Thu, Nov 19, 2009 at 6:20 AM, jkrassman
<joakim.krass...@sportdykare.se>wrote:

> Hi, sorry if I am posting in the wrong group?
>
> I am having a simple nested table, looks like this
>
> <table id=mytable>
> <tbody>
> <tr>
> <td>test</td>
> <td><table><tr><td>New test</td></tr></table></td>
> </tr>
> </tbody>
> </table>
>
> So my problem is that I cant get the last TR within the first table?
>
> var Obj = $("table#list tbody>tr:last");
>
> Of course it looks at the last <tr> in the table, but how should I
> manage to get the last TR in the first table?
>
> Best regards, Joakim
>

Reply via email to