where should i put js code? can it be a part of html doc, using tag <script>? or should it be written as stand-alone file and get linked to html using <link> in head? can u give an example plz? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

where should i put js code? can it be a part of html doc, using tag <script>? or should it be written as stand-alone file and get linked to html using <link> in head? can u give an example plz?

10th Sep 2016, 12:38 PM
–°—ā–į–Ĺ–ł—Ā–Ľ–į–≤ –ü–į–Ĺ—á–Ķ–Ĺ–ļ–ĺ
–°—ā–į–Ĺ–ł—Ā–Ľ–į–≤ –ü–į–Ĺ—á–Ķ–Ĺ–ļ–ĺ - avatar
4 Réponses
+ 7
You also use <script> to link to a separate js file, not <link>. You can do one or the other. Using a separate file is usually a good idea. It can even be cached by the browser, which is useful if you use the same js file in different html pages. <script> //your javascript code here </script> <script src="path/to/your/external_script.js"></script>
10th Sep 2016, 12:46 PM
Zen
Zen - avatar
+ 2
the world enginers computer advice to put js code before body closing tag like the <script></script></body> cuz it will let ur page load
11th Sep 2016, 2:02 PM
mhennaoui
mhennaoui - avatar
+ 2
–Ņ–ĺ–ľ–ĺ–≥–ł—ā–Ķ
12th Sep 2016, 6:51 AM
Oxun Mamajonov
Oxun Mamajonov - avatar
0
v
2nd Nov 2016, 7:32 PM
—é—Ä—Ė–Ļ –Ī–ĺ–Ľ—Ė–Ĺ–ĺ–≤—Ā—Ć–ļ–ł–Ļ
—é—Ä—Ė–Ļ –Ī–ĺ–Ľ—Ė–Ĺ–ĺ–≤—Ā—Ć–ļ–ł–Ļ - avatar