title: When do you put Javascript in body, when in head and when use doc.load?
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/196702/where-to-place-javascript-in-a-html-file">Where to place Javascript in a HTML file?</a><br>
    <a href="https://stackoverflow.com/questions/3531314/should-i-write-script-in-the-body-or-the-head-of-the-html">Should I write script in the body or the head of the html?</a>  </p>
  </blockquote>
  
  
  
  <p>I've always wondered, mainly because when creating pages I always run into trouble, based on the following thing:</p>
  
  <p>When do you write your javascript</p>
  
  <ul>
  <li>In the <code>&lt;head&gt;</code></li>
  <li>In the <code>&lt;body&gt;</code></li>
  <li>with a <code>$(document).ready()</code></li>
  </ul>
  
  <p>I could be stupid, but I've had a few times when my JavaScript (/jQuery) wasn't executed because of the wrong place or yes or no <code>doc.ready()</code> command. So I'm really wondering so.</p>
  
  <p>Same goes for jQuery and 'var' command</p>