Placement of Script Tag in HTML File
It is a very common question where you should place your script tag. Few people prefer placing it after head tag and few prefer placing it somewhere in the body tag. If there is no manipulation of HTML elements on page load, then it is okay to place it in the head tag. But if there is some manipulation of HTML elements like adding styles, adding event handlers etc, then you should place it right before closing body tag.
There are 2 examples given below. In first example, we are changing background of button control by placing script tag in the head tag. In second example, we are adding same script tag before closing body tag. For your information, first example will not work because you are changing background of a control which has not been loaded yet.