我有一个表,需要使用 jquery 删除它的列。使用它但它会删除所有标题,但我希望只删除第一行标题。
<table border="2" style="border-collapse:collapse;">
<tr>
<tr>
<th rowspan="2">#</th>
<th rowspan="2">A</th>
<th rowspan="2">B</th>
<th rowspan="1" colspan="3">C</th>
</tr>
<tr>
<th>C-1</th>
<th>C-2</th>
<th>C-3</th>
</tr>
<tr>
<td>CONTENT</td>
<td>CONTENT</td>
<td>CONTENT</td>
<td>CONTENT</td>
<td>CONTENT</td>
<td>CONTENT</td>
</tr>
</table>
我需要删除列 A 及其相应的 tds ,所以我正在使用:
$('tr td:nth-child(2), tr th:nth-child(2)').remove();
它删除了 TH-A 及其列 CONTENT 但<th>
:C-2 也被删除了,请帮助。