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 trialPaul Henry
2,125 PointsCopied code exactly and nothing shows up
I checked to make sure the src is correct in the html file, and copied Dave's code exactly. When I hit preview, nothing shows up on the page. I see other people have had this problem, but I haven't seen a solution offered yet.
var html = ' ';
for (var i = 1; i <= 10; i +=1) { html += '<div>' + i + '</div>'; } document.write(html);
5 Answers
Anthony Scott
Courses Plus Student 9,001 Pointsmine wasn't running because I forgot the = between script and "script.js in the html file.... and it was giving me no error in the console so it was confusing at first.
Alexander Davison
65,469 PointsTry pressing Cmmd+Shift-i on a Mac when viewing the result or Ctrl+Shift+i on Windows while seeing the result.
What do you see in the Console?
Paul Henry
2,125 PointsNothing shows up in the Console at all... It's weird because in a later exercise using the colored circles, it works just fine.
Roshini Thiagarajan
8,941 PointsTry to do an inspect element on the page that opens up upon 'Preview'. There are also chances when copy-pasting code that characters are not represented as required for example ' ' ' maybe represented with another ASCII character.
Isaac Kim
1,379 PointsIt may have something to do with adding the src.
In the video he tells you to put: <script src="js/script.js"></script>
but if you take "js" our (so just: <script src="script.js"></script>), it works correctly. Hopefully that helps, not sure why adding the "js" to guide it isn't working correctly.
Ashi A
2,531 Pointsdepends on where you saved the file. If you save it inside a folder called "js", then the instructions in Dave's video work.
if you don't save it inside a folder called "js" but instead create the file in the same place as your html, then you don't need to add the js folder to your path. you can use "script.js" and it should work.
Anthony Scott
Courses Plus Student 9,001 PointsIn your JavaScript try HTML += instead of HTML =+
Andrea Faciane
10,042 PointsThank you Anthony Scott, I pursued the next exercises and found the same problem. I ventured into the HTML. There was no <ol> <li></li> </ol> to begin with.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Musical Playlist</title>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>My Music Playlist</h1>
<script src="js/playlist.js"></script>
</body>
</html>
I'm confident that this was the issue. at least with "My Music Play List Lesson" I figured this out. I'll see if the =+ , =+ makes a difference and thanks again!
Andrea Faciane
10,042 PointsAndrea Faciane
10,042 PointsI have tried all the suggestions above...
the issue has not been resolved. I do not see the results
Andrea Faciane
10,042 PointsAndrea Faciane
10,042 PointsI'm kinda just shaking my head and raising my right eyebrow... I think you knew that there was no list in the HTML...