Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Introducing JavaScript Where Does JavaScript Go?

New to javascript

Ok, i created a file called scripts.js on a site I am playing with. When i type the alert it doesnt show up. when i add the javascript directly to the html it works fine

2 Answers

Be sure that you're including a <script> tag that points to the location of the JavaScript file you want your browser to use.

Let's say you have your index.html and your app.js file in the same folder: your script tag should look like this:

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

If you have your Javascript file in a separate folder called "js", for example, you should do this:

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

Thanks. I got it now. I knew it was something simple although I had to read your message about 5 times. Thanks again

I've edited my post to show the code a little better.

Here's some more reading about relative vs. absolute path names. This is something that developers use a daily basis, so it's worthwhile to have a solid understanding of this concept.