title: jquery - printelement() on click
body: <p>I am trying to get a colorbox to print using jquery printElement. The problem is this code does not work. If I do not wrap the on() round it soon as the color box loads the print dialog for the printer opens. </p>
  
  <p>Otherwise it does not print on the click. I get the error in console 
  <strong>$("#toprint").printElement is not a function</strong></p>
  
  <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="js/jquery.printElement.js"&gt;&lt;/script&gt;
  &lt;link href="css/print.css" rel="stylesheet" type="text/css" media="print" /&gt;
  &lt;script type="text/javascript"&gt;
      $(document).ready(function(){
          $("#print-invoice").on("click", function(event){
              $('#toprint').printElement();
          });
      });
  &lt;/script&gt;
  </code></pre>