On Nov 29, 8:21 pm, breadwild <breadw...@gmail.com> wrote: > I have seen several examples on jQuery plugin sites that have the > <script> tag and Javascript within the <body> and not the <head> where > I thought it was supposed to go.
"Supposed to go" is a subjective consideration. The rationale for putting it at the bottom of the body is a fairly simple, and fairly persuasive, argument about performance. A nice short version of that is here: http://developer.yahoo.com/performance/rules.html#js_bottom The rationale for putting it in the head is really one about being unobtrusive. If JavaScript is used unobtrusively, then JS is never plain data, but always metadata. And the head is the place for metadata. I almost always choose the latter, because it simply feels cleaner to me. But I'm not dogmatic and if your CMS makes it more practical to put in the body, then go with that. There is one real advantage in jQuery to using the bottom of the body. At that point, the DOM is already loaded, and you can run without putting everything inside a $ (document).ready() function. -- Scott