title: Run JavaScript function when the DOM is "ready"?
body: <p>I'm using a JavaScript upload script that says to run the initialize function as soon as the DOM is ready. I currently have it working just fine with either a call to the function with <code>body.onload</code> or directly after the function is defined. The function builds some HTML in a placeholder div that acts as the file uploader tool.</p>
  
  <p>My question is what is the best practice here? Since it works for now, why would the instructions say to run the init function as soon as the DOM is ready? Should I be adding a &lt;script> tag directly after the placeholder DIV for example?</p>