Scripts in <head>
Scripts to be executed when they are called, or when an event is
triggered, are placed in functions.Put your functions in the head section, this way they are all in one
place, and they do not interfere with page content.
Scripts in <body>
If your is not placed inside a function, or if your script writes page
content, it should be placed in the body section. It is a good idea
to place scripts at the bottom of the<body>element. This can
improve page load, because script compilation can slow down the
display.
In short and simple language:
-
Place library script such as the jQuery library in the head section.
-
Place normal script in the head unless it becomes a performance/page
load issue. -
Place script that impacts the render of the page at the end of
the body