+ 1

Where should we place the JS scripts?

So far, I've learnt that placing the JS scripts in the <head> or/and <body> will delay the subsequent html elements from loading. This is because <script> tags loads first. If you want your HTML page to load fast and timely, i. e. if you want your <head> and <body> sections to load, then you must place you JS scripts after the </body> tag.

22nd May 2020, 12:35 AM
Oluwakemi Audu
2 Antworten
+ 1
You can place your js script just before the closing body tag,as it allows all html to be loaded first
22nd May 2020, 12:38 AM
Abhay
Abhay - avatar
0
Both are correct, it all depends on whether you need to use it before the page loads or after.
22nd May 2020, 2:02 AM
Josshual A. Toro M.
Josshual A. Toro M. - avatar