偶数列の強調表示に関するこの投稿を見ましたが、選択した列のみを強調表示できますか?
彼らが使用するコードは次のとおりです。
$("table.Table22 > tbody > tr > td:nth-child(even)").css("background","blue");
しかし、私はしたい: 注: はclass="highlight"
選択した列にあるため、列 3 を選択class="highlight"
すると、列 2 から削除され、列 3 に追加されます。jQuery は、選択した列に基づいてクラスを追加する必要があります。
<table class="tbl">
<tr>
<th class="firstColumn">
Cell 1:Heading
</th>
<th class="highlight">
Selected column so this should be highlighted
</th>
<th>
Cell 3:Heading
</th>
<th>
Cell 4:Heading
</th>
<th>
Cell 5:Heading
</th>
</tr>
<tr>
<td>
Cell 1:Row 1
</td>
<td class="highlight">
Selected column so this should be highlighted
</td>
<td>
Cell 3:Row 1
</td>
<td>
Cell 4:Row 1
</td>
<td>
Cell 5:Row 1
</td>
</tr>
<tr>
<td>
Cell 1:Row 2
</td>
<td class="highlight">
Selected column so this should be highlighted
</td>
<td>
Cell 3:Row 2
</td>
<td>
Cell 4:Row 2
</td>
<td>
Cell 5:Row 2
</td>
</tr>
</table>