Link .js to html file


Javascript Final Project

I am attempting to link my main.js file to the header in the html file.
My directory tree:

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: 

<!DOCTYPE html>


<script type="text/javascript" src="Destiny/javascript/main.js"></script></head>

The .js file is as follows:

alert("Here is an alert");

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


@zainabrawat ^-------^


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.


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.


And I have made the html lowercase, thanks.

#6 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.