0
Is it better to put the script tag in the head or body tag? đ
Javascript <script>
5 Answers
+ 6
The script put in head will be executed before in the body
+ 5
<head>
<script src="...." defer>
</head>
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
+ 4
This may help you
https://www.sololearn.com/Discuss/1780950/?ref=app
+ 2
It's always better to place script tags just before the closing body tag..so that your html fully loads first and your js code get all the contents of your web page
+ 1
I think its better in the body