我想採取下面的元素HTML,並將其轉換爲下面的後元素HTML。如果使用thead和tfoot作爲post元素沒有任何意義,那麼tbody會起作用。我正在考慮從$('#myTable')開始,並用div封裝它。我正在努力如何最好地移除頁眉和頁腳,並將它們插入適當的表格中。感謝您的任何建議。使用jquery轉換表結構
預元素HTML:
<table id="myTable">
<thead>
<tr>
<th>H1</th>
<th>H2</th>
<th>H3</th>
</tr>
</thead>
<tfoot>
<tr>
<th>F1</th>
<th>F2</th>
<th>F3</th>
</tr>
</tfoot>
<tbody>
<tr>
<th>B1</th>
<th>B2</th>
<th>B3</th>
</tr>
</tbody>
</table>
郵元素:
<div>
<table class="header">
<thead>
<tr>
<th>H1</th>
<th>H2</th>
<th>H3</th>
</tr>
</thead>
</table>
<div>
<table id="myTable" class="body">
<tbody>
<tr>
<th>B1</th>
<th>B2</th>
<th>B3</th>
</tr>
</tbody>
</table>
</div>
<table class="footer">
<tfoot>
<tr>
<th>F1</th>
<th>F2</th>
<th>F3</th>
</tr>
</tfoot>
</table>
</div>
的JavaScript不應該被用於固定標記。 – undefined
爲什麼不呢?我的目的是修復標題,而CSS讓它變得困難。 – user1032531
@undefined ..你能否詳細說明一下? :) – coolguy