Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

CSS jQuery Basics (2014) Introduction to jQuery Ways to Include jQuery in a Project

If you're loading the function last, wouldn't the warning message be shown until the Jquery function is ran to hide it?

Since the DOM is loading before the JS files, that warning message is going to show until the scripts are ran, right? So the warning class should be hidden by default I would imagine. Is that as simple as giving it a display:none as a default in the css?

1 Answer

Chris Shaw
Chris Shaw
26,650 Points

Hi MICHAEL STEVENSON,

That's correct, however it will come down to how large your HTML document is overall as the larger it is, the longer it will take the browser to render it. If you have a fairly small document, something along the lines of 30Kbs with a small JavaScript file you shouldn't see the element in modern browsers (IE10+, Chrome etc.) as they have remarkable fast engines.

If you want to be on the safe side using CSS can be a much better option but depending on your accessibility requirements you will need to be careful as a property such as display with a value of none will cause the element to become invisible to screen readers.

Hope that helps.