If your JavaScript code is below the DOM elements and only modifies them exclusively, you do not need to wait for the DOM ready event.
However, keep in mind editing the DOM element that contains the script element (or, more specifically, before the elementβs closing tag) used to cause big problems in IE6 (thanks to TJ Crowder ) and IE7.
However, this requires built-in scripts , which can be a maintenance problem. It is preferable that your JavaScript be stored externally (and many talk about the benefits of including them before the closing body tag) for many benefits, such as ease of maintenance and fine-grained cache control.
source share