输入:
<table>
<tr>
<td>
<div id="gvMasterGrid_ctl03_pnlWarning" class="warning">
<span id="gvMasterGrid_ctl03_lblWarning">This has a problem</span>
</div>
</td>
</tr>
</table>
输出:
<table>
<tr>
<td>
<!--Moved to next row-->
</td>
</tr>
<tr>
<td>
<div id="gvMasterGrid_ctl03_pnlWarning" class="warning">
<span id="gvMasterGrid_ctl03_lblWarning">This has a problem</span>
</div>
</td>
</tr>
</table>
使用 jQuery。选择器应该是 css 类而不是元素 id
我正在尝试
$(".warning").each(function(){
$(this).closest("tr").after("<tr><td colspan = '999'>" + $(this).html() + "</td></tr>")
});
但它不工作。