What's the best way for selecting a table row by index using jQuery?
Thanks
Use find() method to find the all table rows of the table. Use last() method to get the last row of table.
jQuery Code alert($(". table"). find("tr:last"). find("td").
In this CSS :last-child example, the last row (ie: the last <tr> tag) will have a yellow background color. All other rows in the table will not be styled by the :last-child selector.
If you don't have to worry about nested tables:
$('#tableId tr').eq(4)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With