I have a simple html table that starts off with two rows. Each row contains 2 form fields. User's can add additional rows to the table as follows:
$('a#addRow').click(function() {
$('#jTable tr:last').after('<tr>'+
'<td><input type="text" name="foo[]" value="" id="foo[]" /></td>'+
'<td><input type="text" name="bar[]" value="" id="bar[]" /></td></tr>');
return false;
});
This works fine.
However, if there is an error detected after the form is posted, then I need to recreate the table with the correct number of rows. At the moment, after posting, the table defaults back to the two starting rows only.