how do I print a html form along with its contents

I made and form along with a button to print the form. The form gets printed BUT none of the user input shows up. Is there some way to include the user input?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""><!-- InstanceBegin template="/Templates/Template_plain.dwt" codeOutsideHTMLIsLocked="false" -->

<!-- this code from stackoverflow -->

<script type="text/javascript" src="" > </script>
<script type="text/javascript">

    function PrintElem(elem)

    function Popup(data) 
        var mywindow ='', 'my div', 'height=400,width=600');
        mywindow.document.write('<html><head><title>my div</title>');
        /*optional stylesheet*/ //mywindow.document.write('<link rel="stylesheet" href="main.css" type="text/css" />');
        mywindow.document.write('</head><body >');

        mywindow.document.close(); // necessary for IE >= 10
        mywindow.focus(); // necessary for IE >= 10


        return true;


<!-- end code from stack overflow -->



<p>Complete this form</p>

<div id="container" style="border: 2px solid; width: 600px; padding: 5px;">

    <input type="text" name="F_Name" size=60>
    Street Address:<br/>
    <input type="text" name="F_Address" size=30>
    <input type="text" name="F_City" size=12>
    <input type="text" name="F_State" size=2>
    Zip Code:
    <input type="text" name="F_ZipCode" size=5">
    <input type="reset" value="Reset">

<!-- end #container -->
</div> <!-- end #container -->

<input type="button" value="Print Form" onclick="PrintElem('#container')" />



Dynamically typed values are not part of what .html() gets you. (This comes down to the difference between properties and attributes.)

You can however set the value attribute of each input field to its current value, using something like this:

$('form input[type=text]').each(function() {
  $(this).attr('value', $(this).val());

– then .html() would get you those as well. (Simplified example, using a div element to output the HTML, using only text input fields, … but should be easy enough to adapt/modify.)