Hi, I've got a dynamically created iframe that I'm trying to add a script to. For example:
var iframe = document.createElement("iframe");
I'd like to inject javascript into this iframe. I've got this working without using jquery by creating a script element under the iframe object and adding callbacks to this script object via the readystate & onReadyState events. Now I'd like to try the same thing with jquery.
However if I just do:
$.getScript(url,function() {
myCallback();
});
My script(s) get added to the current document, and references from the iframe object are broken. How can I call getscript on an iframe object?
Tried this which didn't work:
var elementID = $(element).attr('id');
$('iframe#' + elementID).getScript(url, function(){
myCallback();
});