jQuery Add Row to a Table

Sam Deering

Simple jQuery code snippet to add a row to a table. It uses the :last selector to add the row at the end of the table using jQuery’s .after() function.

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

Also see: jQuery HTML Table Plugins

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.