Javascript code doesn't work if I use an Javascript document.

Hello, I work on an audio player for my website but it is only playing if I write the code in my HTML document.
I would like to separate the HTML and JavaScript documents but it doesn’t work with in the of my HTML document.

What could be the problem?

Show us your full code, so we can see what you have tried so far.

When/where are you loading the script?

Try placing it at the bottom of the HTML file before the closing </body> tag or you can add the defer attribute to the script element that is loading the file.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.