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

Sam Deering Sam Deering
Sam Deering is a Front-end Web Developer who specialises in JavaScript & jQuery. Sam is driven and passionate about sharing his knowledge to educate others.

Related books & courses
Available now on SitePoint Premium

Preview for $1