个文本我有一个包含正好与一个和第一个TD这样行的表:如何选择TD,当你知道用jQuery
<tr>
<th>Phone Number</th>
<td>555-555-1212</td>
</tr>
我需要选择TD手机(和替换HTML)通过使用th文本“电话号码”。我可以得到th细胞
$('th:contains("Phone Number")')
但我不知道如何选择相应的td细胞。
个文本我有一个包含正好与一个和第一个TD这样行的表:如何选择TD,当你知道用jQuery
<tr>
<th>Phone Number</th>
<td>555-555-1212</td>
</tr>
我需要选择TD手机(和替换HTML)通过使用th文本“电话号码”。我可以得到th细胞
$('th:contains("Phone Number")')
但我不知道如何选择相应的td细胞。
$('th:contains("Phone Number")').next('td');
$('th:contains("Phone Number")').next("td")
var html = "some html";
$('th:contains("Phone Number")').next('td').html(html);
$( “日:包含( '电话')”)的兄弟姐妹( “TD”)。
如果您只有一个th的兄弟,那么您也可以使用this,否则next()是最好的。