【发布时间】:2011-03-12 08:58:41
【问题描述】:
如何使用 jQuery 为偶数(或奇数)表列着色? (无需手动添加类)
我的标记是:
<table>
<caption>Table caption</caption>
<thead>
<tr><th scope="col">Table header 1</th><th scope="col">Table header 2</th><th scope="col">Table header 3</th><th scope="col">Table header 3</th></tr>
</thead>
<tbody>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
<tr><th scope="row">Table row header</th><td>Table data</td><td>Table data</td><td>Table data</td></tr>
</tbody>
</table>
(它可能包含也可能不包含范围属性或th 标签)
【问题讨论】:
标签: jquery html css jquery-selectors