append row after first row in a html table

html-table, jquery

Solution

Try this:

$("#mainTable tr:first").after(row);

http://api.jquery.com/after/

Problem

I have `var row=<tr><td>val</td><td>val2</td></tr>` and I tried this: ``` $("#mainTable tbody").append(row); ``` but it appends to the end of the table. Also I tried `$("#mainTable tr:first").after().append(row);` But have not got a result yet. Please, help me to understand.

Original source

Related problems