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) Storing and Tracking Information with Variables Capturing Visitor Input

I do not get a prompt message box when using the prompt command

I am following along with the JavaScript video called "Capturing Visitor Input". In the workspace file scripts.js I typed:

prompt('What is your name?');

I saved the file and clicked on Preview Workspace and nothing happened - the webpage loaded with the HTML text but no message prompt with the string "What is your name?". The instructor did the same thing and got a pop up message box containing the string.

Given the very simple line of code I am thinking that this might be a problem with workspace, as workspace has had technical issues very recently. But the support team suggested that I post this question to the community.

Not sure how I could have messed this up.

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Actually, this is most likely a problem with your browser and not the workspace. Even though you code in the workspace, that code is executed in the browser. So let's check a few basics first. Make sure you've saved your file. After clicking on the preview try refreshing the page. If this doesn't work, make sure you don't have any addons that might be blocking popups. If this is also not the problem, you might try clearing your browser cache. Let me know how it goes! :sparkles:

Thanks Jesus and Jennifer. I cleared the cache and that seemed to do the trick. It does not seem to be an issue with the pop up blocker.

Jesus Mendoza
Jesus Mendoza
23,289 Points

Maybe you have pop-up messages blocked?

i am still having problem i did try that same code of what is your name and it did show the prompt message box where i can type my name but after typing my name its just capturing my name and not return to me back the output displaying my name hence its displaying visitorName