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 jQuery Basics (2014) Introduction to jQuery Ways to Include jQuery in a Project

Where good idea add script.js file: in <head> or <body>?

In my script.js file I hide some elements on the page. But if I add file script.js before the tag </body> this element will be visible (yet builds DOM tree) for a few seconds and then disappear. So where should I add file.js in this case?

6 Answers

I just came across this StackOverflow discussion, which may be helpful - sounds like the questioner is having exactly the same issue as you describe.

By the way, I see you're from Yekaterinburg! I only know the name from reading 'Nicholas and Alexandra' many years ago. Is Ipatiev House still there? :)

Hi Ruslan,

Are you using jQuery's hide and show methods?

Yes, I use the hide() method, but not yet loaded the script.js file element is visible, because css is not stipulated that it should be hidden.

Thanks for the reply!

I am very surprised - in place of the Ipatiev's House is now "Church on the blood". =)))

Very interesting - looks like a beautiful church. One day I'll go to Russia - so many things I'd love to see there. :)

Welcome to us)