我看到这篇文章在highlighting even columns,但我可以只突出显示选定的列?jQuery突出显示只在一个表中的选定列
这里是他们所使用的代码:
$("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>
我做了喜欢tableHover插件,但实际上我正在寻找改变在选定的列表中的CSS,但我虽然对于例子,我只是使用高亮。但插件将很快进入我的工作区,谢谢:) – 2009-07-17 14:40:13
谢谢这就是我所需要的。任何机会,你可以帮助我的另一个问题?我已经添加了你的代码以及它:http://stackoverflow.com/questions/1126489/jquery-examples-horizontal-accordion-table-instead-of-un-ordered-lists-upda – 2009-07-17 16:29:19