views:

38

answers:

1

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>
+5  A: 
$('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'
Chacha102
thanks. this helped me get what i needed.
Jason