jQuery add table row

Problem

How do you add a table row using jQuery?  A table has so many different elements in it that things might get screwy.

 

Solution

There is no one statement-to-use-on-all, but the below line is a pretty general answer and should solve your needs even when there are no table rows:

$('#myTable > tbody:last').append('<tr>...</tr><tr>...</tr>');

keywords: jquery add table row
source: http://stackoverflow.com/questions/171027/add-table-row-in-jquery

Tagged with: ,

Leave a Reply