【发布时间】:2019-06-22 05:56:13
【问题描述】:
我在 jQuery 中搜索的一个简单解决方案,用于删除除表中隐藏行之外的所有表行。在这里,我已经尝试过基础级别(对不起,我是新手。)。
$("#example-datatable tbody tr:not(:hidden)").remove();
HTML 代码:
<table id="example-datatable" class="table draggable table-striped table-bordered table-vcenter">
<thead>
<tr>
<th>Account Name</th>
<th>Meeting Date</th>
<th>Start Time</th>
<th>No Of Hours</th>
<th>Project</th>
<th>Status</th>
<th>Created By</th>
<th>Created On</th>
<th>Modified By</th>
<th class="text-center">Action</th>
</tr>
</thead>
<tbody>
<!-- Define the Template TR to Clone for rest of the Rows -->
<tr style="display:none">
<td>accountName</td>
<td>meetingDate</td>
<td>startTime</td>
<td>no_of_hours</td>
<td>projectName</td>
<td>IsActive</td>
<td>employeeDisplayName</td>
<td>createdDate</td>
<td>employeeDisplayName</td>
<td class="text-center">
<!--Buttons Binded here with primarykey ID-->
</td>
</tr>
</tbody>
</table>
【问题讨论】:
-
因为你的问题是目前写的,所以无法回答。
-
请分享您的html,然后我们可以了解您想要做什么
-
请建议我用其他方法来实现这一点。@connexo
-
@RohitVerma,我已经添加了我的html代码。请看一下。
标签: jquery html-table rows