Is there a way to execute jQuery similar to window.eval() in JavaScript? -
i have following code execute javascript in iframe (in case frames[0], since app contains 1 iframe @ given time):
following works if js
contains core/pure javascript:
var js = ""; // javascript code here frames[0].window.eval(js);
but 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 alternative window.eval() in jquery? know .globaleval() there, seems different purpose.
this because jquery didn't load yet, attach onload
or check onreadystatechanged
on iframe figure out when has loaded.
Comments
Post a Comment