Select every visible last child in jQuery
css-selectors, jquery
Solution
You can do it:
$('table tr').find('td:visible:last').addClass('last-visible');
See a full example (jQuery 1.2+ compatible)
Problem
I would like to get the last visible `td` in each `tr` in a table. This does not work because it attempts to select the last child if it is visible: ``` var last_visible_cells = $(table).find("tr td:visible:last-child"); ``` So far the simplest method I've thought of is to use a `.each` to loop through the `tr` elements and append each of the last visible `td`s to a new selector list. Is there a simpler way? Does anything like this exist? ``` var last_visible_cells = $(table).find("tr").lastMatching("td:visible"); ```