title: print div with textarea incl. user input using js
body: <p>I have this simple script that prints a part of a webpage.
  However, it does not print user input.</p>
  
  <p>My goal is to only print the form and the user input; not the rest of the webpage.</p>
  
  <p>I do not want to use css; just js/jQuery and html.</p>
  
  <p>My question is: how can I print various form input elements including the user input? </p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div id="print-content"&gt;
          &lt;textarea&gt;Print User Input&lt;/textarea&gt;
          &lt;input type="button" onclick="printDiv('print-content')" value="print a div!"/&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>js:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      function printDiv(divName) {
          var printContents = document.getElementById(divName).innerHTML;
          var originalContents = document.body.innerHTML;
          document.body.innerHTML = printContents;
          window.print();
          document.body.innerHTML = originalContents;
      }
  &lt;/script&gt;
  </code></pre>