Reputation: 52523
In the following code, how do I select all the <tr>
elements that have a <td>
with an image that ends in cancelled.png
? I am at a loss...
<table>
<tr> <----- select this whole tr
<td>
<img src="/images/icons/invoice-cancelled.png" alt="cancelled" />
<a href='/orders/invoice.aspx?invoiceid=63'>X1087</a>
</td>
... other tds, some with "-cancelled.png" others with something different
</tr>
....
</table>
Upvotes: 0
Views: 66
Reputation: 61567
$('tr:has(td img[src$="cancelled.png"])')
Explanation:
(tr) Select All Table Rows
(:has()) That Have:
(td) a table data
(img) with an image in it
([src$="cancelled.png"]) that has an ttribute of 'src' that ends($=) in
'cancelled.png'
Upvotes: 5