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 trialZiya Jamalov
3,490 PointsJS Loads Before HTML
Hi, everobody! An issue with the loading of JS code I didn't change anything in HTML file. JS code stays before </body> Despite it alert(""); loads before <h1> and sometimes before the page at all
1 Answer
Steven Parker
231,269 PointsThe HTML code actually loads first, but the browser doesn't render it to the screen until the JavaScript program runs and finishes. So it's normal for any "alert" messages in the js code to show before the page does.
Ziya Jamalov
3,490 PointsZiya Jamalov
3,490 PointsHi, Steven, Thanks. Maybe There is any solution for such issue?
Steven Parker
231,269 PointsSteven Parker
231,269 PointsThis is normal operation, it doesn't require a "solution". When communicating from the program, you use "prompt" and "alert". When communicating through the web page, you use event handlers and DOM updates.
Techniques for using event handlers will be covered in later courses.