如何删除所有< tr>从第一个使用jQuery的表除外 [英] How to remove all the <tr> from a table except the first one using jquery

查看:81
本文介绍了如何删除所有< tr>从第一个使用jQuery的表除外的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表格,我想除去第一个表格的所有< tr> 。这里有几种方法,最简洁的就是使用 http://api.jquery.com/gt-selector/rel =noreferrer> :gt() 选择器,如下所示:

  $('#tableID tr:gt(0)')。remove(); 


I am having a table and I want to remove all <tr> of the table except the first one. How can I do this.?

解决方案

There are several methods here, the most terse is to use the :gt() selector, like this:

$('#tableID tr:gt(0)').remove();

这篇关于如何删除所有&lt; tr&gt;从第一个使用jQuery的表除外的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆