title: Creating of a dynamic iframe with a jquery click event
body: <p>When I create an iframe dynamically like this</p>
  
  <pre><code>$( '&lt;iframe/&gt;' )
      .attr('id', 'aaoifr0')
      .attr('src', aPageName)
      .appendTo(_public.content);
  </code></pre>
  
  <p>and add a click event to the <code>body</code> element in the iframe</p>
  
  <pre><code>$('#aaoifr0')
      .contents().find('body').click(function(){ alert(0) });
  </code></pre>
  
  <p>it does not work.</p>
  
  <p>However, if I add the event manually after the iframe is displayed, via firebug, like this:</p>
  
  <pre><code>$('#aaoifr0').contents().find('body').click(function(){ alert(0) });
  </code></pre>
  
  <p>it works fine!</p>
  
  <p>I've tried several ways to check the load sync/async of the iframe content but couldn't find a useful answer. Any ideas how to make this work?</p>