jQuery: how to select the last N columns of each row in a table? -
i have table 6 columns. want run function on last 3 columns of each row (excluding header row). have following selector working:
$('table.listviewtable > tbody > tr:gt(0)').find('td:gt(2)') .each(function () { runmyfunction($(this)); });
is there way in 1 selector (ie, without intermediate find
)?
update:
i've tried
$('table.listviewtable > tbody > tr:gt(0) td:gt(2)')
and
$('table.listviewtable > tbody > tr:gt(0) > td:gt(2)')
but did not work. returned 4th, 5th, , 6th columns of 2nd row , columns of subsequent rows.
here go:
$('table.listviewtable td:nth-child(n+4)')
live demo: http://jsfiddle.net/simevidas/qj3tp/1/
(i'm assuming you're using th elements header cells.)
Comments
Post a Comment