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
You may use this jQuery Plugin.
/**
* clone element, including the textarea part
*/
$.fn.clone2 = function(val1, val2) {
// ret for return value, cur for current jquery object
var ret, cur;
ret = $(this).clone(val1, val2);
cur = $(this);
// copy all value of textarea
ret.find('textarea').each(function() {
var value_baru;
// use name attribute as unique id
value_baru = sek.find('[name="$name"]'.replace('$name', $(this).attr('name')))
.val();
// set the new value to the textarea
$(this).val(value_baru);
});
// return val
return ret;
}