JavaScript
Article
By Sam Deering

jQuery clone table row and make empty

By Sam Deering

Quick jQuery snippet to clone a table row (and make empty) appended to a table.

--ADVERTISEMENT--

var clonedRow = $('tbody tr:first').clone();
clonedRow.find('input').val('');
$(this).prev().find($('table tbody')).append(clonedRow);
Recommended
Sponsors
The most important and interesting stories in tech. Straight to your inbox, daily. Get Versioning.
Login or Create Account to Comment
Login Create Account