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 trialAlexander Melo
4,297 PointsNothing is happening...
When i write the javascript nothing happens. I double checked everything there is no console error and any error on the html. Can someone help me out here?
<!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>';
}
4 Answers
Samuel Steed
2,568 PointsI had the same issue with this workspace. I checked the console and was getting an error loading the script.js file. It finally resolved after I moved the script.js file out of the js folder and changed the reference from
<script src="js/script.js"></script>
to
<script src="script.js"></script>
...not sure what's up with that folder as it seemed to be working for Dave.
miikis
44,957 PointsHey Alexander, So if you want to see your output in the console, you need to:
console.log(html);
Otherwise, you're just creating a variable and not doing anything with it.
Alexander Melo
4,297 PointsThis is exactly how Dave wrote it in the video and numbers appeared with a light gray circle around it and when i preview nothing appears but thanks I will try to console.log it.
Alex Pacheco
8,327 PointsI had this exact same problem. Try saving it in html and in the javascript file and then preview it. This finallly worked for me.
Ben Rawlins
9,093 PointsYou are forgetting to add document.write(html) after the for loop.
Lanie Williamson
Courses Plus Student 11,390 PointsLanie Williamson
Courses Plus Student 11,390 PointsI also had this problem and checked several forum links and this was what finally helped. Thanks Samuel!