title: Print a specific div from a page via pressing ctrl+p
body: <p>I want to print a <code>div</code> from a web page when i press default print button's via keyboard. But i don't have any idea how to do. </p>
  
  <blockquote>
    <p>I tried with <code>keypress</code> but it will print if i press any key from the
    keyboard, but i want to print if press the key pair <code>ctrl+p</code>.</p>
  </blockquote>
  
  <p><strong>I try something like:</strong></p>
  
  <pre><code>$(document).bind('keypress', 'ctrl+p', printContent);
  function printContent(){
      var restorepage = document.body.innerHTML;
      var printcontent = document.getElementById("print_div").innerHTML;
      document.body.innerHTML = printcontent;
      window.print();
      document.body.innerHTML = restorepage;
  }
  </code></pre>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;h1&gt;My Print page&lt;/h1&gt;
  &lt;div id="print_div"&gt;
      It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
  &lt;/div&gt;
  </code></pre>
  
  <p>If any one give me the idea then it will be helpful for me. </p>
  
  <p>Thanks in advance.</p>