I have a table (#tbLog) and need to select all table rows (tr) that contain a class called private.
Thanks
Approach 2: Use $('table tr:last') jQuery Selector to find the last element of the table. The 'table' in query looks for the table element then 'tr' is looking for all the rows in the table element and ':last' is looking for the last table row of the table.
Using .var $row = $(this). closest("tr");
you have to get last child tr of table using last-child selector and then get first td child using first-child selector. Show activity on this post. References : : last.
Simple enough:
$("#tbLog tr.private").action();
If you have sub tables (why?), then use this instead to only select the top level tr
s
$("#tbLog > tbody > tr.private").action();
Note that I've included tbody
in the selector as nearly all browsers will add this tag for you (it's part of the spec).
This how it's done:
$('#tbLog tr.private')
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