热门标签 | HotTags
当前位置:  开发笔记 > 前端 > 正文

如何在第一个tr之后将tr添加到表中?[重复]-Howtoprependatrtoafterfirsttratatable?[duplicate]

PossibleDuplicate:InsertingnewtablerowafterthefirsttablerowusingJQuery可能重复:使用JQuer

Possible Duplicate:
Inserting new table row after the first table row using JQuery

可能重复:使用JQuery在第一个表行之后插入新表行

I have populated a tr for my table and I want to prepend it after the firts tr. I use this:

我为我的桌子填充了一个tr,我想在firts tr之后添加它。我用这个:

$('#myTable').prepend($tr);

As usual, it adds my new tt to the top.

像往常一样,它将我的新tt添加到顶部。

How can I add it as second?

如何将其添加为秒?

3 个解决方案

#1


26  

You will want to use jquery after, like this:

您将需要在之后使用jquery,如下所示:

$('#myTable tr:first').after($tr);

#2


6  

You can do one thing keep the first tr to of the table and rest tr to of the table.

你可以做一件事保持表的第一个tr到并将tr放到表的。

Now do

现在做

$('#myTable tbody').prepend($tr);

#3


0  

You need to use .after

你需要使用.after

$('#myTable > tbody > tr:first').after($tr);

推荐阅读
author-avatar
景科儒_189
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有