Script Location within HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Script Location within HTML

In this example, the script is located in the head. Would this cause functionality issues since it’s not located at the end of the body? With the way it’s set up now, my understanding is that elements on the page won’t be loaded before the script is run.

9th Dec 2017, 3:38 PM
Céleste Robinson
Céleste Robinson - avatar
1 Answer
+ 6
Well, if the script loads before the document, if it involves getting some elements, then yes. Else, no.
9th Dec 2017, 3:40 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar