title: Recursively access iframes after they've loaded with jQuery
body: <p>I've looked at the related questions here but am having a slightly different problem.</p>
  
  <p>I am rewriting anchors across nested iframes, sometimes 3 or 4 iframes deep.</p>
  
  <p>I use .load( function(){} ) to wait for each to load before accessing the anchors. This works fine when only going one iframe deep, but fails after that.</p>
  
  <p>Here is the code:</p>
  
  <pre><code>function retarget_links( content ) {
  
      content.find("a").attr("href","#") ;
  
      var frame = content.find("iframe") ;
      if ( frame.length ) {
          frame.load(function() {
              retarget_links( frame.contents() ) ;
          })
      }
  }
  
  retarget_links( $("body") ) ;
  </code></pre>
  
  <p>It finds all of the iframes recursively, but it will only perform the .load callback for the first one.</p>
  
  <p>Any ideas why?</p>
  
  <p>Thanks!</p>
  
  <p>NOTE: All iframe documents are in the same exact domain – I can access all frames' contents via the console.</p>