Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prepend a tr to after first tr at a table? [duplicate]

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

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

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

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

How can I add it as second?

like image 549
kamaci Avatar asked Mar 04 '11 12:03

kamaci


People also ask

How do you add TR after current TR?

How do you add TR after current TR? Basically, you create a copy from the tr element (which includes child nodes) and insert that copy after that element. Therefore, you need the . live binding to make sure that newly created a elements do also invoke that click handler.

Can you wrap a TR in a div?

You should not be doing that... is not a valid HTMl markup... Rows can not be wraped by divs.

How do you add the first row in a table?

Shift cells down Insert a cell and move the existing cells down one row. A new row is added at the bottom of the table.


1 Answers

You will want to use jquery after, like this:

$('#myTable tr:first').after($tr);
like image 89
Mark Steggles Avatar answered Sep 19 '22 18:09

Mark Steggles