title: How to print a specific Div content in JQuery with radio and text values
body: <p>I have a Html page with radio button placed on a div tag. I need to print the DIV content. I will select a radio option and I need to print with the radio checked state.</p>
  
  <p>Here is the code I have tried</p>
  
  <p>Script code:</p>
  
  <pre><code>function PrintDoc(printarea){
      var mywindow = window.open('', 'PRINT', 'height=400,width=600');
  
      mywindow.document.write('&lt;html&gt;&lt;head&gt;&lt;title&gt;' + document.title + '&lt;/title&gt;');
      mywindow.document.write('&lt;/head&gt;&lt;body &gt;');
      mywindow.document.write('&lt;h1&gt;' + document.title + '&lt;/h1&gt;');
          mywindow.document.write(document.getElementById('printarea').innerHTML);
      mywindow.document.write('&lt;/body&gt;&lt;/html&gt;');    
      mywindow.document.close(); // necessary for IE &gt;= 10
      mywindow.focus(); // necessary for IE &gt;= 10*/
      mywindow.print();
      mywindow.close();
      return true;
  }
  </code></pre>
  
  <p>HTML Code</p>
  
  <pre><code>&lt;DIV id="printarea"&gt;
      &lt;input type="radio" name="myRadio" value="1" /&gt; 1 &lt;br /&gt;
      &lt;input type="radio" name="myRadio" value="2" /&gt; 2 &lt;br /&gt;
      &lt;input type="radio" name="myRadio" value="3" /&gt; 3 &lt;br /&gt;
  &lt;/DIV&gt;
  </code></pre>
  
  <p>I have tried the Windows.Print() option but it prints the entire page. I need exact div only like the image given below</p>
  
  <p><a href="https://i.stack.imgur.com/428Qw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/428Qw.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/DZ6Fn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DZ6Fn.png" alt="The image when I got printed"></a></p>