A couple quick examples that might help (there're many more ways): console.log( $('table tr:last').prev() );
var trow = $('table tr'); console.log( $(trow[trow.length-2]) ); console.log( trow.eq(trow.length-2) ); Modify the selectors as needed for multiple/nested tables. HTH On Jun 16, 10:46 am, theprodigy <tigerseyet...@gmail.com> wrote: > I've been trying for a while to alter the second to last row of a > table. I've tried several ways. The number of rows is dynamic so I > can't hard code a number into nth-child. I used $rowNeeded = > $thisRow.parents('table:first').children().children().length - 1 to > get the second to last row, but it doesn't seem like I can pass this > variable into nth-child either. > > How can I select the second to last row of a table? > > Thanks