0

Whats difference does it make to have the script tag in head and in body?

Wondering how would the OP vary with having Script tag in JS in heading and in body

3rd Dec 2018, 1:09 PM
Saurav Uppoor
Saurav Uppoor - avatar
1 Resposta
+ 1
Putting script in the body allows the instructions to run after the elements preceding that spot to be loaded first. Functions in a script that is loaded before an element that it is attempting to manipulate will need a deferral mechanism (e. g. window.onload) to work properly.
3rd Dec 2018, 1:27 PM
Janning⭐
Janning⭐ - avatar