using jquery how do alter the css of the last tr with a th
$("#mytable tr").has('th').last().parents('tr').css({'color':'blue'});
HTML
<table border="1" id="mytable">
<tr>
<th>row 1, cell 1</th>
<th>row 1, cell 2</th>
</tr>
<tr>
<th>row 1, cell 1 - change this</th>
<th>row 1, cell 2 - change this</th>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>
As an alternative to xdazz's answer, I'd offer:
References:
:has()
selector.Find the last
th
, and its parent should be the lasttr
who hasth
.