I have the following code to execute JavaScript in an iframe (in this case frames[0], since the app contains only 1 iframe at any given time):
Following works if js
contains core/pure JavaScript:
var js = ""; // JavaScript code here
frames[0].window.eval(js);
But it does not work if 'js' contains jQuery:
var js = ""; // JavaScript or jQuery code here
var preview = document.createElement('iframe_id');
preview.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" ;
document.body.appendChild(preview);
frames[0].window.eval(js);
Is there any alternative to window.eval() in jQuery? I know .globalEval() is there, but it seems to be for a different purpose.