Is there a way to clone form field values in jQuery or javascript?
jQuery has a clone() function that clones the actual form with no problem, but it doesn't preserve any values that have been entered into the form. Is there a way to get around this? Sample code would be much appreciated. ran into the same problem, simple solution: // touch all input values $('input:text').each(function() { $(this).attr('value', $(this).val()); }); var clones = $('input:text').clone(); the trick is that this will change the actual 'value' attribute in the DOM tree, otherwise the data you enter 'on-the-fly' only exists in the DOM 'state' Stemming from the notes, here's a