Home > database >  my javascript file will not link to my index.html file and i see nothing wrong with it. What is wron
my javascript file will not link to my index.html file and i see nothing wrong with it. What is wron

Time:03-11

here is my index= https://github.com/25garcial/calculator/blob/main/index.html

here is my JavaScript= https://github.com/25garcial/calculator/blob/main/script.js

I don't know what is wrong with the code and i have asked my teacher and he does not know either.

CodePudding user response:

Replace script tag in your index file with this :

<​script​ ​src="​script.js​"​>​</​script​>

CodePudding user response:

At the bottom of the body tag in index.html file link your Javascript file with a script tag:

<script src="./yourfilename.js"></script>

CodePudding user response:

To link your script try using:

<script src="script.js"></script>

For more informations see : https://www.w3schools.com/tags/att_script_src.asp

Also note: You can use the defer attibute if you want your script to load after the HTML parsing and loading rather than putting it at the end of your body.

<script src="script.js" defer></script>
  • Related