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 trialRichard Chandler
3,516 PointsNone of my Javascript code is showing up in my preview page. Can someone help me please?! I am saving my work.
document.write('This will not show up in my preview page');
Richard Chandler
3,516 PointsWhat do you mean? shouldn't that show up? or does it have to be connected to an html file?
Richard Chandler
3,516 Pointsdocument.write(shit ain't workin);
-> random.js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/main.css">
<title>JavaScript Basics</title>
</head>
<body>
<div class="container">
<h1>Random Number Generator</h1>
<script src="random.js"></script>
</div>
</body>
</html>
-> index.html
Jason Berteotti
12,352 PointsWe cannot see your code to help you. Snapshot your workspace and share the link so we can review it.
1 Answer
Falk Schwiefert
8,706 PointsHave you saved both the html and the js file? Otherwise it won't show.
as far as the code goes:
<body>
<div class="container">
<h1>Random Number Generator</h1>
</div>
<script src="random.js"></script> <-- put this just before the closing of the body and not inside the div
</body>
document.write("fun stuff"); <-- make sure the stuff you want to write is in quotes " " or ' '
Jesse Zelaya
13,599 PointsJesse Zelaya
13,599 PointsCould you provide all of your code?