[英]Jquery copying the attribute of the the thead tr td to the tbody tr td
[英]Insert a tr and td inside a thead
我目前有一個cshtml / javascript / jQuery webapp,我想在<table>
的現有<thead>
內的<tr>
內插入<td>
<table>
。 我不知道如何在現有的<thead>
插入<tr>
<thead>
。 我知道如何創建並填充它,但是如何插入新行?
我要插入:
<tr class="ligne" style="height: 0px; background-color: white;">
<td style="border-bottom: black 1px solid; padding-bottom: 0px; height: 1px; padding-top: 0px;" colSpan="6"/>
</tr>
我想將其插入下面的所選行下面:
我該如何實現?
嘗試這個 :
<thead id='insert_tr'>
</thead>
這是您的thead,您可以將tr和td都插入到thead中,如下所示:
var appendtr = "";
appendtr += "<tr><th></th></tr>";//And last append this variable inside thead:
$("#insert_tr").append(appendtr);
您也可以在for循環的幫助下插入多個tr和td和th
for(var tr = 1; tr <= 5; tr++)
(
appendtr += "<tr><th></th></tr>";
$("#insert_tr").append(appendtr);
)
如果您要在廣告使用以下代碼后插入<tr><td></td></tr>
,
$('#GrilleBilan .t-grid-header').after('Your element to insert')
我正在使用表ID(#GrilleBilan),因為如果您有多個表,它不會將其替換為其他表。
對不起,我錯過了
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.