<script> tag - In <head> or <body> ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson

<script> tag - In <head> or <body> ?

Which one is better, adding script tag within the head section or the body?

15th Jul 2018, 9:23 AM
2 Answers
+ 1
At the top of end body tag. Because its wait untill your html and css is rendered. Thus making nice user interface. Hope thid helps☺️☺️.
15th Jul 2018, 9:35 AM
Meet Mehta
Meet Mehta - avatar
+ 1
It depends. But this has been asked before. https://www.sololearn.com/discuss/1363615/?ref=app
15th Jul 2018, 9:41 AM
Janning⭐ - avatar