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('...');

Also see: jQuery HTML Table Plugins

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.

Free Guide:

How to Choose the Right Charting Library for Your Application

How do you make sure that the charting library you choose has everything you need? Sign up to receive this detailed guide from FusionCharts, which explores all the factors you need to consider before making the decision.


Ending Soon
Free SitePoint Premium

Get one free year of unlimited book and course downloads on SitePoint Premium!