JavaScript JavaScript Basics Hello, JavaScript! Add JavaScript to HTML

Micheal Jones
Micheal Jones
1,352 Points

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 89,667 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. :)

Lukasz Milde
Lukasz Milde
3,377 Points

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

Claire Friloux
Claire Friloux
5,974 Points

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.