嗨我有一張桌子裏面我有一張桌子。如何編寫jquery選擇器以僅獲取父錶行?jquery只選擇父表的行
<table class="required_capacity">
<tr>
<td>Row1</td>
<td>Row1</td>
</tr>
<tr>
<td colspan="2">
<table>
<tr>
<td>Some Text ... </td>
</tr>
<tr>
<td>Some Text ... </td>
</tr>
</table>
</td>
</tr>
<tr>
<td>Row 3</td>
<td>Row 3</td>
</tr>
上面的html代碼
我需要得到的只有$( 'required_capacity')錶行。我試過這個選擇器得到行
$('.required_capacity_table').children('tr')
但它在邊桌行也給?
這個類名用在另一個表中,然後它也得到另一個表的tr,所以你可以使用表的id(在你的表中應用id)。 – Hkachhia
謝謝Harry我用id試過也沒用,它返回內錶行 – Prasanna