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 trial

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

Alert does not generate dialog box only a blank screen on chrome.

In scripts.js in the workspace when I type alert("Hello from Treehouse");

and hit preview I just get a blank screen in chrome.

7 Answers

Thomas Workman
Thomas Workman
7,173 Points

Hmm...should work. Maybe post your code just in case something is missing. Might try refreshing Chrome and trying the preview again. You can also test the same thing by opening the browser inspector in Chrome and entering alert("what ever string you want here"); in the console.

Also, jsfiddle.net is useful for doing some JS testing. Hope that helps.

The code is just

alert("Hello from TreeHouse");

I used jsfiddle.net and it seems to be working for now. Thanks.

Same issue, I have tried the above to no avail.

Same issue for me here on google Chrome. It showed the alert the very first time I typed

alert("Hello from Treehouse!");

and then saved,

but once I added the following code,

document.write(<h1>Welcome to JavaScript Basics</h1>);

alert("Thanks for visiting!");

it's not worked since, even when I commented out the last two lines like this.

alert("Hello from Treehouse!");

//document.write(<h1>Welcome to JavaScript Basics</h1>);
//alert("Thanks for visiting!");

I've searched Google for answers and have tried the following solutions as well,

  1. Close offending tab and re-open
  2. Close and Restart browser
  3. Close browser and restart computer

Anyone had any luck solving this? Regards,


Same with Safari, I have tried using script.js and html file both the same, just the grey bar and nothing else when trying to view.

Nelly Nelly
Nelly Nelly
7,134 Points

Same issue here, My solution was to work in my text editor rather than the workspace and launch index.html in the browser :) It works like a charm. make sure to create the index.html, scripts.js and the folder with main.css :)