Trying to select all rows where a cell in a specific location contains a specific value.
example:
<table>
<tr>
<td>1</td>
<td>MO</td>
<td>MO Williams</td>
</tr>
<tr>
<开发者_开发问答;td>2</td>
<td>PG</td>
<td>MO Williams</td>
</tr>
</table>
I want to ONLY select the rows where the 2nd contains MO.
I've tried this:
$('tr:has(td:eq(1):contains(MO))')
but that doesn't work. Thank you.
Selects all td
elements:
$("tr").find("td:eq(1):contains('MO')")
working example: http://jsfiddle.net/hunter/jBbS7/
Selects all tr
elements:
$("tr").find("td:eq(1):contains('MO')").parents("tr");
working example: http://jsfiddle.net/hunter/jBbS7/4/
精彩评论