jQuery clone table row and make empty

Sam Deering
Share

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);