开发者

Inserting new table row after the first table row using JQuery

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

I use the following code

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

but I think I'm doing something wrong here


Maybe $("#table tr:first").after("<tr><td>some</td><td>content</tr></tr>"); may be easier? Here's demo.


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

So it would be actually enough to call

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜