Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

David MacDonald
919 Pointsin script.js nothing is appearing when i use preview. How can i get the alert and header to appear?
I have the index.html file. Preview opens to port80 instead of web. Nothing appears after i enter the statement and command.
3 Answers

Jeff Wilton
16,633 PointsThere are three things to note, so lets take a look one at a time.
First, your index.html file should load the scripts.js file:
index.html
<!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">
<script src="scripts.js"></script>
</div>
</body>
</html>
Second, your scripts.js file should have an alert statement and a document.write statement:
scripts.js
alert("Hello from Treehouse!");
document.write("<h1>Welcome to Javascript Basics</h1>");
Third, when you open the preview window, it should go to port 80 with a URL something like this: http://port-80-i0up09r7h4.treehouse-app.com/
(this URL is unique to me, so use whatever URL opens when you click preview in your workspaces.
If you do all of the above and you still don't see the alert in the preview window, then try doing a hard refresh (Ctrl+Shift+R in Firefox or Chrome) or clear your browser cache.
Hope this helps!

Tre Dudman
10,575 PointsCtrl+Shift+R did the trick, thanks heaps!

Jay Reyes
Python Web Development Techdegree Student 15,936 PointsAlso, make sure you disable any AdBlocks you may have running - this is for future readers :)