Dho*_*oha 1 html javascript jquery birt
我有一个由BIRT生成的html表如下:
<table id="myTableID">
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</table>
Run Code Online (Sandbox Code Playgroud)
我想编写一个读取此表的JavaScript代码,并以下面的形式重写它:在<thead>标记中获取表的第一行,以及标记中表的其余部分<tbody>:
<table id="myTableID">
<thead>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
我有关于JavaScript的基本知识,但我不知道如何处理这种情况.请帮忙吗?
thead元素tr内部thead$('<thead></thead>').prependTo('#myTableID').append($('#myTableID tr:first'));
console.log($('#myTableID')[0].outerHTML);Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<table id="myTableID">
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
<tr>
<th></th>
<th></th>
<th></th>
</tr>
</table>Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2167 次 |
| 最近记录: |