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 onpaste
. This is why I am setting it from js.
$('#HtmlEditorFDEdit-inputCmp-iframeEl').contents().find("body").attr("onpaste", "alert('you pasted');");
This works, however I would like to call a function myFunction
instead of alerting.
The following gives me a Uncaught ReferenceError: myFunction is not defined
$('#HtmlEditorFDEdit-inputCmp-iframeEl').contents().find("body").attr("onpaste", "myFunction();");
I tried moving the function around; from the bottom to the top of the external js file.
I am not even able to the following; (text is blank)
var text="asd";
$('#HtmlEditorFDEdit-inputCmp-iframeEl').contents().find("body").attr("onpaste", "alert(text);");
Any ideas as to what is going wrong?
Thank you!