使用JQuery在第一表行之后插入新表行 [英] Inserting new table row after the first table row using JQuery

查看:57
本文介绍了使用JQuery在第一表行之后插入新表行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有id="#table"的表,然后是带有id="headings"的第一行,现在正好在标题行之后,我需要插入一个新行

I have a table with id="#table" and then the first row with id="headings", now directy after the heading row I need to insert a new row

我使用以下代码

$("#headings").after($("#table").prepend("<tr>...</tr>"));

但是我想我在这里做错了

but I think I'm doing something wrong here

推荐答案

嗯,.after() ref .prepend() ref 要求"HTML字符串","DOM节点"或"jQuery"对象作为参数.

Well, .after()ref and .prepend()ref require a "HTML string", a "DOM node" or a "jQuery" object as argument.

所以实际上就足够了

$('#headings').after('<tr><td></td></tr>');

这篇关于使用JQuery在第一表行之后插入新表行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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