title: How can I access the contents of an iframe with JavaScript/jQuery?
body: <p>I would like to manipulate the HTML inside an iframe using jQuery.</p>
  
  <p>I thought I'd be able to do this by setting the context of the jQuery function to be the document of the iframe, something like:</p>
  
  <pre><code>$(function(){ //document ready
      $('some selector', frames['nameOfMyIframe'].document).doStuff()
  });
  </code></pre>
  
  <p>However this doesn't seem to work. A bit of inspection shows me that the variables in <code>frames['nameOfMyIframe']</code> are <code>undefined</code> unless I wait a while for the iframe to load. However, when the iframe loads the variables are not accessible (I get <code>permission denied</code>-type errors).</p>
  
  <p>Does anyone know of a work-around to this?</p>