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 Hello, JavaScript! Add JavaScript to HTML

The Alert command box

Once I make an alert command, the alert box doesn't pop up when I refresh the page. What can be the reason behind why It wont pop up?

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hi Michael.

There could be any number of reasons.

alert("Your message here");

Is how the syntax goes.

If you've included it in a function of your own make sure you've called it.

You can also check for console errors in your browser's DevTools. :)

File SCRIPT.JS must be nested in JS folder, otherwise SRC address is wrong.

I had a similar issue. Had the code exactly as written but wasn't popping up when ran. Try saving the updated script.js and index.html files then try running it. Mine ended up working after saving the files.