tags:

views:

39

answers:

2

How do I add class="x" to the last table cell that's on the same row as the one that has class="insert"? Something like:

$('td.insert').parents('tr').(':last-child').addClass('x');
+4  A: 

You can do that like this:

$('td.insert').siblings(':last-child').addClass('x');

This filters the sibling cells, leaving only the last child to add the class to.

Nick Craver
Hehe a second faster :)
Ivo Sabev
Nick, I'm going to give it to the little guy.
cf_PhillipSenn
+2  A: 
$('td.insert').siblings(':last-child').addClass('x');
Ivo Sabev