0

How to get <tr> object via jQuery using one of cell content for example Some Text?

<tr style="border: 1px solid #07234B; border-collapse: collapse;">
 <td style="border: 1px solid #07234B; border-collapse: collapse; padding: 2px 2px 2px 2px;">
     Some text
 </td>
 <td style="border: 1px solid #07234B; border-collapse: collapse; padding: 2px 2px 2px 2px;">
     7/8/2012 
 </td>
</tr>
4

3 回答 3

2
$("td:contains('Some text')").parent()
于 2012-07-09T21:59:33.283 回答
2
$('td').find('Some Text').parentUntil('tr');
于 2012-07-09T22:00:13.330 回答
1

试试这个:演示 http://jsfiddle.net/YYdCE/

var tableRow = $("td").filter(function() {
    return $(this).text() == "Some text";
}).closest("tr");
于 2012-07-09T21:59:52.777 回答