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.

JavaScript JavaScript Basics (Retired) Introducing JavaScript Your First JavaScript Program

3,424 Points

when I click the preview,Why there is nothing show up?

please tell me why?

Julian Gutierrez
Julian Gutierrez
19,201 Points

Can you please post your code so we can better assist you?

Add your code and I can help you.

I had the same problem. You have to click File --> Save first. Then preview.

Christopher Denny
Christopher Denny
10,460 Points

One thing I suggest is selecting the "index.html" page and previewing that since javascript has no default display properties and leaves that up to the html.

If you are already doing this, I would suggest double-checking and ensuring that the javascript file is linking properly in your HTML file i.e. <script src = "script.js"> and placing this at the end of your html file inside of the <body> tag.

If you're still having issues, it's likely the Javascript not running because there is an error somewhere in your code, in which to properly deduce what the issue is, we will need to see your code.

Wish you the best, Yi! -Christopher Denny

4 Answers

Jonathan Wright
Jonathan Wright
5,853 Points

Make sure you are not running any sort of adblockers on your team treehouse pages. I have found that this will cause issues with some of my code.

Denise Edwards
Denise Edwards
4,921 Points

This was my problem exactly!

I use Adblocker on Google Chrome. When I excluded blocking from all pages in the teamtreehouse.com/* domain, and refreshed the preview page it started working :)

George Nono
George Nono
11,256 Points


I have figured this out, I had the same problem. I'm not sure if you fixed it or not but this is what I did.

I created a new workspace - I made a file and titled it "index.html" - I added the following: <!DOCTYPE html> <html> <head></head> <body> <script src='scripts.js'></script> </body> </html>

I then created another file and titled it "scripts.js" - I typed in the alert and the document.write and it worked.

If you have any questions please contact me.

I faced the same problem.

Step 1: I renamed the scripts.js file to myscripts.js

Step 2: Change the file name in the src attribute in index.html. Save changes.

Step 3: Click on Preview button. If the browser opens up a blank page, then add /index.html.

It should like http://port-80-xxxxxxx.treehouse-app.com/index.html and then hit enter.

Didn't want to clear my cache so did this and it worked perfectly. Thanks

Jared Lenover
Jared Lenover
2,120 Points

My alert command didn't seem to work properly when I was in Firefox. (Might just be my settings.)

I logged into Treehouse in Chrome and tried again. Worked. :)