Where do I put the links to my Javascript/jQuery files in my html file?

Posted by Qlidnaque on Stack Overflow See other posts from Stack Overflow or by Qlidnaque
Published on 2011-01-01T23:48:14Z Indexed on 2011/01/01 23:54 UTC
Read the original article Hit count: 324

Filed under:
|
|
|
|

I recently noticed that some (not all) of my javascript and jQuery scripts wouldn't work unless I put the link for the .js files nearer towards the bottom of the page instead of the head area where I put my links for my .css files.

From what I understand, javascript can go in either places and it is recommended to not be put in the header as it slows down the page loading process as well. At the same time, if I put it in the body tag of the html file, it looks somewhat messy and was wondering what the best practice is for putting .js files in a cleanly place. Should I always put it at the very bottom right before the ending body tag? How do professional web developers handle this?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html