title: onpaste calling a function javascript/jQuery
body: <p>I am trying to call a function when something is pasted into a field.
  Because I am using ext.net, I can not hardcode the function into the <code>onpaste</code>. This is why I am setting it from js. </p>
  
  <pre><code>$('#HtmlEditorFDEdit-inputCmp-iframeEl').contents().find("body").attr("onpaste", "alert('you pasted');");
  </code></pre>
  
  <p>This works, however I would like to call a function <code>myFunction</code> instead of alerting. </p>
  
  <p>The following gives me a <code>Uncaught ReferenceError: myFunction is not defined</code></p>
  
  <pre><code>$('#HtmlEditorFDEdit-inputCmp-iframeEl').contents().find("body").attr("onpaste", "myFunction();");
  </code></pre>
  
  <p>I tried moving the function around; from the bottom to the top of the external js file.</p>
  
  <p>I am not even able to the following; (text is blank)</p>
  
  <pre><code>var text="asd";
  $('#HtmlEditorFDEdit-inputCmp-iframeEl').contents().find("body").attr("onpaste", "alert(text);");
  </code></pre>
  
  <p>Any ideas as to what is going wrong?</p>
  
  <p>Thank you!</p>