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 trialAyush Bahuguna
2,092 Pointsalert and document.write functions are not working.
I have saved the file and I have checked with the code that has been typed by the instructor, but still, document.write() is not printing on page.
4 Answers
tate
13,435 PointsAre you sure you are putting quote marks "" around the strings? Eg.
alert("hello");
document.write("hello");
Michal Jankowski
4,051 PointsHave you linked the js. file to the index.html file? It's tough to help you without seeing the code.
Ayush Bahuguna
2,092 PointsYes. I have. I have rechecked several times with the instructor's code, but still I can't get it to print on my page.
john teo
1,779 PointsI had the same problem until I realized that I opened the previous index.html file from the previous video lessons instead of the current one. Maybe you encountered the same mistake?
Michal Jankowski
4,051 PointsI think you should show us the code ;)
Ned Redmond
5,615 PointsI'm having the same issue.
var visitorName = prompt('What is your NAME?');
var message = "Hello " + visitorName + "! Welcome to Treehouse.";
message += " Eat a butt, dirtbag.";
document.write(message);
I'm just not seeing anything populate to the page.
Ayush Bahuguna
2,092 PointsAyush Bahuguna
2,092 PointsI have used single quotes. My code is exactly what the instructor had typed. He got the message printed on the page, but it didn't work for me.