【发布时间】:2012-03-16 04:38:13
【问题描述】:
我有一个这样的头:
<thead>
<tr>
<th rowspan="2">Cell-1</th>
<th rowspan="2">Cell-2</th>
<th colspan="3">Header</th>
<th rowspan="2">Cell-6</th>
</tr>
<tr>
<th">Cell-3</th>
<th">Cell-4</th>
<th">Cell-5</th>
</tr>
</thead>
我需要创建一个 jquery 选择器,其中单元格的正确顺序为 1-2-3-4-5-6。现在我的选择器看起来像这样:
hdrCols = thead.find( "tr:first th[rowspan=2], TR:first TH[rowspan=2]").add( thead.find( "tr:last-child th, TR:last-child TH" ) );
这给了我 1-2-6-3-4-5 并破坏了我的布局。
有没有办法创建一个选择器,以正确的顺序获取单元格?我无法移动列,因此任何解决方案都必须包含它。
【问题讨论】:
标签: javascript jquery html-table jquery-selectors