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 trialAnna Astle
13,614 PointsMy javascript wont run
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Circles</title> <link rel="stylesheet" href="css/styles.css"> </head> <body id="color"> <script src= "js/script.js"></script> </body> </html>
var html = ' ';
for ( var i= 1; i <= 10; i += 1) { html += '<div>' + i + '</div>'; } document.write ( html );
1 Answer
Steven Parker
231,236 PointsIs that two separate files pasted above? The HTML is expecting the JavaScript to be in "script.js" inside the "js" folder, is that where it is?
To facilitate a more accurate analysis of the issue, make a snapshot of your workspace and post the link to it here.
Anna Astle
13,614 PointsAnna Astle
13,614 Pointshttps://w.trhou.se/kew8948h02
I'm working on this section of treehouse: For Loops with Dave McFarland
Thanks for the link to the snapshot video. That is SO easy and helpful. As you can now see for yourself. The Javascript is in fact inside the folder js with the name script.js .
Steven Parker
231,236 PointsSteven Parker
231,236 PointsIn the snapshot, the "script.js" file is in the root (top-level) folder where "index.html" is. The "js" folder is there, but empty.
Just move the "script.js" file into the "js" folder. Either drag it using the left pane, or type "
mv script.js js
" in the command pane.And would the person who downvoted this answer please leave a comment and let me know how I can improve? Thanks!
Anna Astle
13,614 PointsAnna Astle
13,614 PointsThanks so much! I wouldn't have caught that otherwise.