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 The JavaScript Console

Cora Weiss
PLUS
Cora Weiss
Courses Plus Student 1,271 Points

alert("hello there"); not rendering

js code:

alert("hello there");
document.write("No it works!");
console.log("program complete");

html includes:

<script src='scripts.js'></script>

Why is this not working?

6 Answers

Aaron Pedersen
Aaron Pedersen
5,856 Points

I had the same problem. I would click the preview icon but no alert would display and the console gave the same errors. After clicking the refresh button on the browser (Chrome) it worked as it should. I'm not sure why it was doing that. Maybe it had something to do with the cache.

Luke Liem
Luke Liem
6,367 Points

Hitting the refresh button in Chrome does the trick for me!!!

Michael Hulet
Michael Hulet
47,913 Points

My guess is that you blocked your site from displaying alerts. Check your browser's settings for how to un-block it

Hey there Cora!

So depending on your browser you should be able to bring up a console. This is a text input area where you can test individual bits of code in real time. (If you're using Google Chrome you'll find it in Developer Tools in More Tools.)

If you were to enter alert("hello there!") into the console, it does in fact throw and alert, so there's no problems there in terms of syntax. If it doesn't, then you'll need to re-enable pop up alerts in your browser window. A quick Google search should give you a detailed how-to.

Igor Cavalcante
Igor Cavalcante
5,025 Points

i fixed the code as the teacher told. Im not having the alerts too.

Im using chrome, and even when i save the changes, the javascript console is giving me the same error.

So i think the problem is not in the browser, the problem is that the changes are not saving......

Thomas Cormier
Thomas Cormier
2,496 Points

I am using Chrome as well. I have found that with a lot of these videos, you need to close your workspace and clear your browser data in between every video. Its a pain, but it works.

With Chrome, you should go into your advanced settings and manage exceptions in:

chrome://settings/ *Content Settings *JavaScript -> Manage exceptions -> Create new entry in the list [.]teamtreehouse.com -> Done Plugins -> Manage exceptions -> Create new entry in the list [.]teamtreehouse.com -> Done PopUp -> Manage exceptions -> Create new entry in the list [.]teamtreehouse.com -> Done

I fixed my problem with this steps