Where is the best place to put <script> tags in HTML markup?

Posted by mipadi on Stack Overflow See other posts from Stack Overflow or by mipadi
Published on 2009-01-12T18:15:54Z Indexed on 2010/05/07 13:58 UTC
Read the original article Hit count: 228

Filed under:
|
|

When embedding JavaScript in an HTML document, where is the best place to put the <script> tags and included JavaScript? I seem to recall that you are not supposed to place these in the <head> section, but placing at the beginning of the <body> section is bad, too, since the JavaScript will have to be parsed before the page is rendered completely (or something like that). This seems to leave the end of the <body> section as a logical place for <script> tags.

So, where is the best place to put the <script> tags?

(This question references this question, in which it was suggested that JavaScript function calls should be moved from <a> tags to <script> tags. I'm specifically using JQuery, but more general answers are also appropriate.)

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript