JavaScript | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
+ 1

JavaScript

How do I link my JavaScript file to the html ?

28th Nov 2019, 8:12 PM
Ernest Samuel
Ernest Samuel - avatar
5 Respuestas
+ 3
To do that, first insert the <script> tag into your HTML file as following: <script src="LocationInFolder"></script> If you want to run the file before the page loads, put the tag in the <head> tag. If you want to run the file after the page loads, put the tag in the <body> tag.
30th Nov 2019, 1:34 PM
Justinas Kimtys
Justinas Kimtys - avatar
+ 4
Hello Ernest Samuel Please take a look at the sololearn Tutorial HTML, CSS3 and Javascript. That is the fastest way to learn this. Regards kiuziu
28th Nov 2019, 8:29 PM
Kiuziu 💘 Berlin
Kiuziu 💘 Berlin - avatar
+ 3
<script src="filename.js" type= "text/javascript"/>
28th Nov 2019, 9:40 PM
A͢J
A͢J - avatar
+ 1
thank you
28th Nov 2019, 8:44 PM
Ernest Samuel
Ernest Samuel - avatar
+ 1
Put the two files ( html and Javascript) in the same folder between < head > and </head> <script src = "nameOfJavaScriptFile.js"></script>
30th Nov 2019, 12:34 AM
Ahmed Belkhodja