title: Is there a way to execute jQuery similar to window.eval() in JavaScript?
body: <p>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):</p>
  
  <p>Following works if <code>js</code> contains core/pure JavaScript:</p>
  
  <pre><code>var js = ""; // JavaScript code here
  frames[0].window.eval(js);  
  </code></pre>
  
  <p>But it does not work if 'js' contains jQuery:</p>
  
  <pre><code>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);  
  </code></pre>
  
  <p>Is there any alternative to window.eval() in jQuery? I know .globalEval() is there, but it seems to be for a different purpose. </p>