+ 2

Where is better to include JavaScript in HTML. In tag Body or Head?

16th Jul 2018, 10:39 AM
Cлaвeн Ђервида
Cлaвeн Ђервида - avatar
3 Respostas
+ 3
Include in the head tag for JavaScript library that need to be loaded before could process by other scripts. eg jQuery, moment.js... Include in body before closing body tag for scripts that need to render the DOM elements, eg. scripts that run getElementById, querySelector functions
16th Jul 2018, 12:13 PM
Calviղ
Calviղ - avatar
0
At the top of end body tag. Because its wait untill your html and css is rendered. Thus making nice user interface. Hope this helps☺️☺️.
16th Jul 2018, 10:46 AM
Meet Mehta
Meet Mehta - avatar
0
Thanks, I am beginner.😊
16th Jul 2018, 10:48 AM
Cлaвeн Ђервида
Cлaвeн Ђервида - avatar