title: what exactly document-ready means in jquery
body: <p>Let us say I have a HTML page that contains a javascript file:
   </p>
  
  <p>The base.js is like this:</p>
  
  <pre><code>$(document).ready(function () {
     obj.init();
  }
  
  // ..............
  
  var obj = {...};
  </code></pre>
  
  <p>Surprisingly, <strong><em>sometimes</em></strong>(not all the time) Firebug shows me the undefined error on <code>obj.init()</code> call! My understanding is that document ready means all html elements, including images, javascript files downloaded and executed(?).</p>
  
  <p>I believe in order to find the root cause of this error, we need understand what exactly the "document ready" means? anybody has any insight?</p>
  
  <p>============================</p>
  
  <p>Update: maybe I should not mention about image over here, my main concern is regarding the javascript file in particular. Does "DOM fully constructed" include "all javascript code executed"?</p>
  
  <p>============================</p>
  
  <p>Update again: It seems people here agreed that event "document.ready" WILL NOT be triggered until ALL javascript code got downloaded and executed. Thus, root cause of the issue remain unknown. I did bypassed this issue after I moved the $(document).ready block to the bottom of the javascript file.</p>