![](/img/trans.png)
[英]In a <table>, how to get the <th> right above some <td> when the <th>s all have different colspan?
[英]How to return the table with javascript or jquery by returning another table with all the rows that contains a td that doesn't have a colspan
如何通過返回包含所有未包含colspan的td的所有行的另一個表返回帶有javascript或jquery的表
<table>
<tr>
<td> text1 </td>
<td> text2 </td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td colspan="2"></td>
</tr>
<tr>
<td> text3 </td>
<td> text4 </td>
</tr>
</table>
因此我期望
<table>
<tr>
<td> text1 </td>
<td> text2 </td>
</tr>
<tr>
<td> text3 </td>
<td> text4 </td>
</tr>
</table>
您可以使用:has
選擇器為此使用一行jQuery:
$('table tr:has(td[colspan])').remove();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.