我有一个包含多个 tbody
的表格。如何为每个 tbody
创建标题?这样做对吗?我使用 jquery ui sortable。如何确保每个 tbody
的标题不可排序?现在我是通过以下方式触发 sortable:
$("#sortable > tbody").sortable({});
<table>
<thead>
<tr>
<th>Col1</th>
<th>Quantity</th>
<tr>
</thead>
<tbody>
<tr>
<th scope="rowgroup">Col1</th>
<th>100</th>
<tr>
<tr>
<td>Col1</td>
<td>20</td>
<tr>
<tr>
<td>Col1</td>
<td>30</td>
<tr>
<tr>
<td>Col1</td>
<td>50</td>
<tr>
</tbody>
<tbody>
<tr>
<th scope="rowgroup">Col1</th>
<th>100</th>
<tr>
<tr>
<td>Col1</td>
<td>20</td>
<tr>
<tr>
<td>Col1</td>
<td>30</td>
<tr>
<tr>
<td>Col1</td>
<td>50</td>
<tr>
</tbody>
</table>
<thead>
元素吗?交替使用 thead、tbody、thead、tbody……是否可行?但如果您关心HTML验证,我不确定它是否是有效的HTML。 - Terry Youngtbody
,但只能有一个thead
和tfoot
。然而,你可以给你的tbody
一些 CSS 类,并使其中的某些特定类可排序。 - Yanick Rochon