Search code examples
javascriptjqueryformsclone

clone html form WITH values


I am trying to duplicate a form after it has been filled out. So the user fills out the form then hits submit. then a new window opens with the full html form, images, and styling included AND the values so they can print the filled out version. i tried .html() and .clone(). but neither seem to work.

any help is much apperciated. and please don't hesitate to ask questions.


Solution

  • Edit: Post your code for creating the popup.

    You may need to use val() to copy the values over. http://jsfiddle.net/Na6GN/2/

    $('#myForm :input').each(function() {
        $(this).clone().appendTo('#newForm').val($(this).val());
    });