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 trialRuslan Galiev
4,121 PointsWhere 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
Cena Mayo
55,236 PointsI 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? :)
Cena Mayo
55,236 PointsHi Ruslan,
Are you using jQuery's hide and show methods?
Ruslan Galiev
4,121 PointsYes, 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.
Ruslan Galiev
4,121 PointsThanks for the reply!
I am very surprised - in place of the Ipatiev's House is now "Church on the blood". =)))
Cena Mayo
55,236 PointsVery interesting - looks like a beautiful church. One day I'll go to Russia - so many things I'd love to see there. :)
Ruslan Galiev
4,121 PointsWelcome to us)