JavaScript
Article

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.

var clonedRow = $('tbody tr:first').clone();
clonedRow.find('input').val('');
$(this).prev().find($('table tbody')).append(clonedRow);

No Reader comments

Recommended
Sponsors
Get the latest in JavaScript, once a week, for free.