0
How can i link JavaScript to html please
3 Respuestas
+ 7
Before the ending body tag ( </body> )
Add a script tag in which you can have an attribute called src which tells html that where to look for that js file.
<script src="main.js"></script>
Now if u have main.js in the same directory as index.html, they both r linked.
in sololearn you don't need to link both files though.
+ 3
Ismail Idris can you clarify your question as there are various ways to link JavaScript to HTML ...
here is one example:
https://code.sololearn.com/W6bDfp1m5kTp/?ref=app
+ 1
Thanks for the correction.