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 Review Introducing JavaScript

Linking a Js file on html?

I need to link "apps.js" file on my html. I tried with:

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

It doesn't' work, what i am missing?

4 Answers

Dave McFarland
STAFF
Dave McFarland
Treehouse Teacher

It's "app.js" not "apps.js" -- no 's' after app.

Thank you Dave

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,254 Points

That should work, even without a type src attribute declaration. Are you sure your script is in the same folder as your HTML file?

Well i don't know that ( is a quiz question). I tried to put some random folder name like "script", "js". But none of them worked.

It's possible that your apps.js file is in a different directory than your html file. If that's the case then you'd have to specify the exact path to your apps.js file. Instead of src="apps.js" it could maybe be src="js/apps.js". Hope that helped a little. :)

Ya i think that's the problem. But is a question from a quiz and i don't find anything about the folder of the js file ( i don't know if it's in the same folder or not).