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>');
精彩评论