Usually, this type of error concerns the path. Try to prepend a “/” to your path, like: <script src="/js/question.js"></script>
Solution 1 :
Problem :
I am having trouble linking my javascript to my HTML. I can get my CSS to link but the javascript won’t? I have two javascript pages and both won’t link.
Here’s what I wrote in the HTML:
<script src="js/question.js"></script>
<script src="js/app.js"></script>
Comments
Comment posted by Tanner Dolby
You might not be providing the correct path to
Comment posted by ddastrodd
Also, adding the relevant code snippet would help us to help you.
Comment posted by ebbstar21
@TannerDolby it’s not telling me what’s wrong, it’s just highlighting it and not linking
Comment posted by ebbstar21
@ddcastrodd I’m sorry, I am doing this for an assessment, I wasn’t sure how much code to insert into the question. How much is a relevant code snippet?
Comment posted by Johannes
Typically, this would be due to an incorrect filepath. If for example your HTML file is inside a folder which is on the same level as the