title: Check if element is loaded
body: <p>I have a site and an iFrame in that site, as well as a lot of other content (images and so on).</p>
  
  <p>Now I'm using jQuery's <code>$(document).ready(function() { ... });</code> to execute code. In that code, I'm trying to manipulate content in the iFrame. However, I have to assure the iFrame is loaded to execute the code.</p>
  
  <p>The iFrame usually loads in exactly the same time when the code is executed, so it sometimes fails and sometimes not.</p>
  
  <p>If I use <code>$('#iframe').load(function(){ });</code>, the event is not always executed, because at that moment I attach that load listener, the iFrame may be already finished with loading, and the load event won't get executed again. If I leave it away, the elements are sometimes not yet there (the code get's executed too early).</p>
  
  <p>So what I want to achieve is something like that:</p>
  
  <pre><code>if iFrame is already loaded
    -- execute code 
  else 
    -- $('#iframe').load(function() { /*execute code*/ });
  </code></pre>
  
  <p>Is there a better way to achieve this without using a dirty timeout? Or if using this approach, is there a function which checks if the element is already loaded or not?</p>