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

Maurice Tafolla- Cunningham
Maurice Tafolla- Cunningham
7,708 Points

The prompt is not showing, why is that?

in scripts.js I typed:

prompt("What is your name?");

and it didn't work when I saved and hit the preview button, so I typed:

prompt('What is your name?');

That didn't work either when I saved and previewed. Do I really just suck at Javascript?

Maurice Tafolla- Cunningham
Maurice Tafolla- Cunningham
7,708 Points

In order to answer if I really just suck at Javascript I replicated this exercise on my computer in Sublime Text and it worked. Treehouse I suggest you look into your text editor.

Cheers

That code is correct. Where are you writing this code? Is it on the challenges or somewhere else?

Maurice Tafolla- Cunningham
Maurice Tafolla- Cunningham
7,708 Points

Hi Adam I am writing this in Treehouse's browser-based text editor.

I am currently in: JavaScript > Javascript Basics > Storing and Tracking Information with Variables > Capturing Visitor Input

4 Answers

Are you sure you entered the prompt command as the value of the variable.

Like so:

var answer = prompt("What day is it?");

This way the prompt that will appear is linked to the answer variable. That way whatever day the user types will already be stored and you may call it somewhere else to perform an action.

Maurice Tafolla- Cunningham
Maurice Tafolla- Cunningham
7,708 Points

Absolutely. It doesn't matter what I type in to scripts.js, or where I place it in the index.html nothing displays.

I tried moving the <script src="scripts.js"></script> into the head of index.html. I even renamed the scripts.js to something else.

This is most likely a bug with the Workspace. (I also tried opening and closing my current session and switching to a blank version and that did not produce results.)

I just created a workspace here and it worked perfectly. Can you access this workspace?

Maurice Tafolla- Cunningham
Maurice Tafolla- Cunningham
7,708 Points

Yeah I checked out your workspace; however, there was no way to preview the work I was doing.

I can see under js > main.js your example and how it should all work. I just moved on from the video and am on the next one where the workspace is working fine. I was able to replicate the results from the previous video so it's not a big deal.

I noticed that the code in main.js was the answer for the quiz AFTER the video titled "Capturing Visitor Input". I just want to make sure you know where I encountered this bug. It was in the workspace for the "Capturing Visitor Input" video and not in the quiz titled "Capturing Visitor Input and Writing it to the Page".

The workspace in question is "JavaScript Basics - Capturing Visitor Input".

I'll let Treehouse sort it out, thanks for your help.

I will get it reported to the staff at Treehouse for you. Hope the remainder of the course goes well for you and good luck.

Luke Liem
Luke Liem
6,367 Points

In my Window 8 Chrome, at first the prompt did not show. But the moment I hit "Refresh", the prompt appeared.

Dawn Mercurio
Dawn Mercurio
2,501 Points

The same worked for me on Chrome on my Mac.

Michael Kalmykov
Michael Kalmykov
8,919 Points

+1 to this, Chrome on mac and while alerts in previous lessons worked the prompt in this lesson does not until I refresh.

replicated project in Atom and works as expected on first load.

I'm going to be powerhousing through these JS lessons I hope you guys have some devs looking into the JS bugs in your workspaces