Jas*_*son 0 jquery css-selectors
在以下代码中,如何选择具有以图像结尾的所有<tr>元素?我很茫然...<td>cancelled.png
<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>
Run Code Online (Sandbox Code Playgroud)
$('tr:has(td img[src$="cancelled.png"])')
Run Code Online (Sandbox Code Playgroud)
说明:
(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'
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
52 次 |
| 最近记录: |