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 trialAlex Franklin
12,403 PointsJS executes in diff order than shown & the vid shows the doc.write<h1> text inside the input, but mine shows up below it
I'm using Chrome and have been following along for months without any issues until starting JS.
(1) alert("Hello from Alex");
(2) document.write("<h1>Welcome to my Website!</h1>");
(3) alert("Thanks for stopping by");
WHAT SHOULD BE: Video shows the first alert (1), then the text for document.write<h1> appears inside the input box (2), and finally the last alert appears (3).
WHAT IS: My 3 JS lines are occurring (1) (3) (2), with both alerts (1) & (3) executing before the document.write<h1> text (2). Also, my document.write<h1> text is showing up outside of and below the input box, but it is inside of the input for the video...
CAN SOMEONE PLEASE HELP ME UNDERSTAND WHAT I'M DOING WRONG OR WHAT I'M MISSING??
4 Answers
Steven Parker
231,236 PointsI don't think you've done anything wrong, the video is probably a few years old and browser behavior has changed since then. New browsers don't reder anything to the page until the script has completed, so it's normal to see both alerts first.
Also, the appearance of the message would be affected by both the HTML and CSS parts of the code, which are not shown here. You can share a complete workspace by using the "snapshot" function (the camera icon) and then posting the link it gives you here.
Lesley Bulbeck
1,583 PointsI experience exactly the same too. Thanks for the answer about browser behaviour. If things have moved on, should the video be updated, Treehouse?
Steven Parker
231,236 PointsOther than a complete course re-do (they call it "refresh"), I don't think the videos get changed. But in at least one of the videos there's a mention of this in the "Teacher's Notes" section.
Joshua Furmanczyk
4,299 PointsI'm experiencing the same thing as alex, I agree it's likely the browser.
Lesley Bulbeck
1,583 PointsThanks, Steven. So you'd recommend checking the Teacher's Notes section if we suspect that a video may be out of date?
Steven Parker
231,236 PointsNot just then, the Teacher's Notes often contain useful information either directly about the video or related to the information presented. I'd say always take a quick look to see if anything is in there.