Ask coding questions

← Back to all posts
Linking HTML and JavaScript
ZControls_Games (22)

I used <script type="text/javascript" src="script.js"></script> but it still didn't work.

Comments
hotnewtop
Prospy006 (0)

*Realizing this post was posted 2 years ago

Prospy006 (0)

its ez lol, <script src="script.js"></script>
Use this code in html to easily get your script.js and html linked..

SameeraMurthy (109)

I think the problem is you are trying to do something with the DOM, and linked resources in the wrong order.

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

If you included your repl link, it wouldve been easier to answer.
Hope this helps!

SPQR (595)

Also, is the <script> tag enclosed in your <head> </head> tags?

SPQR (595)

Could you include a link to your repl? It'd make it a lot easier to help.