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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Emma Sawyer](https://secure.gravatar.com/avatar/674d9225fb26c5052f4992b1d712ed55?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Emma Sawyer
369 PointsI can place JS code directly in HTML file but linking to the math.js file through script tags not working?
Have not had this problem before, cannot find any errors in script tag writing <script src = "math.js"></script> ?
4 Answers
![Bekah McDonald](https://uploads.teamtreehouse.com/production/profile-photos/3567722/micro_Rainbow_bob__crop_.jpg)
Bekah McDonald
10,527 PointsHi Emma
I can't see an error in your script tag. Is your math.js file saved in the same folder as your index.html file? If ever my JavaScript isn't working at all, it's because I've forgotten to include the whole file path (eg. script src="js/math.js"
)
Moderator marked as Best Answer
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYour script tags look good.
Though in general you should avoid spaces around the equal sign when setting attributes in the tag.
Without seeing more of your project, a folder mismatch would be my first guess as to the cause of the issue. Check that your JS file is actually located in the same folder as your HTML. It's common to have a subfolder named "js" — perhaps it's there instead?
If that's not it, to facilitate a complete and thorough analysis, make a snapshot of your workspace and post the link to it here.
![Emma Sawyer](https://secure.gravatar.com/avatar/674d9225fb26c5052f4992b1d712ed55?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Emma Sawyer
369 Pointshttps://w.trhou.se/g31bt1h79e Here is a snap shot, my comment below elaborates
![Steven Parker](https://uploads.teamtreehouse.com/production/profile-photos/969492/micro_tool_chess_set_2.jpg)
Steven Parker
230,688 PointsYour snapshot confirms the folder mismatch. You could move your file or just change the reference to it:
<script src="js/math.js">
![Emma Sawyer](https://secure.gravatar.com/avatar/674d9225fb26c5052f4992b1d712ed55?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Emma Sawyer
369 PointsI hope this link helps. The .js file is in the same workspace , all files I'm using are in the JS folder like it was already set up.
![Bekah McDonald](https://uploads.teamtreehouse.com/production/profile-photos/3567722/micro_Rainbow_bob__crop_.jpg)
Bekah McDonald
10,527 PointsThanks for sharing your workspace.
While your .js file is in the same workspace, you've got it inside a folder called js. This is absolutely fine, but you just need to include that in your src, eg. <script src="js/math.js"></script>
It's exactly the same as what you're doing with your .css file. By including js/
in the src link, you're just telling it which folder contains your math.js
file.
Let me know if that helps!
![Emma Sawyer](https://secure.gravatar.com/avatar/674d9225fb26c5052f4992b1d712ed55?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Emma Sawyer
369 PointsThanks all, I changed the source to include the js/ folder and that worked! Somehow I missed that point way back. Thank you!!!
Steven Parker
230,688 PointsSteven Parker
230,688 PointsTo the Moderator:
To help me to improve the quality of future answers, could you explain what criteria was used to determine the chosen answer as "best"?
Haoz Bach Ly
3,709 PointsHaoz Bach Ly
3,709 PointsThank you very much, getting stuck with this matter for a while.