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
Eric Vandenberg
9,095 PointsSublime Text 3 - Help w/ grouping files
Hi I'm trying to use Sublime and my .js file doesn't link to my html even though I've included <script src="script.js"></script> at the end of the <body> tag. I saved both the .html file and the .js file within the same folder but still no luck..
How do I get these two files to interact with each other when I view them in the browser. I've been checking to see if my javascript is working in the web developer console of firefox but still not working.
Am I missing something with the build option or save project options of Sublime?? Thanks
8 Answers
Chase Lee
29,275 PointsDid you put the script tag at the bottom of the body element?
Eric Vandenberg
9,095 Pointsyep sure did... I'm wondering if maybe it might be something to do with using ../ before script
for instance:
<script src="../script.js"></script>
or
<script src="./script.js"></script>
or
<script src="script.js"></script>
Chase Lee
29,275 PointsJust to make sure the, name of your script file is "script.js"?
Chase Lee
29,275 PointsThat wouldn't help if it was in the same folder as sister file. The reason is because ../ takes it one level up on the file structure.
Does that make sense?
Eric Vandenberg
9,095 Pointsyea, that makes sense. And yes the file is script.js. I was going to post a screen shot pic but can't figure that out either! Haha
Chase Lee
29,275 PointsYou can upload a picture to imgur and then link the photo.
Eric Vandenberg
9,095 PointsAwesome thanks! Imgur
Chase Lee
29,275 PointsSorry, I'm only familiar with Sublime Text 2. What do the groups do? It just might be the problem.
Chase Lee
29,275 PointsTry something like console.log("Hello World!") and tell me what happens.
Eric Vandenberg
9,095 Pointsundefined :/
Eric Vandenberg
9,095 PointsI input the same code into Treehouse Workspaces and previewed in the browser. It worked perfectly. I was able to see "Hello World!" and when I called 'button' the id=action showed up just like it should.
It has to be something I'm doing wrong with Sublime...like where I'm saving my files locally or...something else. I'm not sure