Link .js to html file


#1

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
Javascript Final Project

<In what way does your code behave incorrectly? Include ALL error messages.>
I am attempting to link my main.js file to the header in the html file.
My directory tree:
Desktop/Destiny/javascript/main.js

The html file is in the “Destiny” directory and the main.js is in the javascript directory.

I am supposed to create an alert in the .js file and link to the header of the html.

```

The html file is as follows:


The .js file is as follows:

alert(“Here is an alert”);


When I open the html file in the browser, no alert appears.

<do not remove the three backticks above>

#2

@zainabrawat ^-------^


#3

Why don’t you put them in the same directory, so you can link the JS with src="main.js"?
Also, you should make <HTML></HTML> lowercase.


#4

Well, Destiny is the main project folder, and javascript is a folder within the destiny folder. I just want to have a distinct folder for all javascript files.


#5

And I have made the html lowercase, thanks.


#6

@biesack.samlive.com If your HTML file is within Destiny as well, then you do not need to include that in the path to the javascript file.

Just put javascript/main.js.