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.

JavaScript jQuery Basics Introducing jQuery jQuery vs. JavaScript

I was following the teacher's activity in my workspace and none of them worked for me like in the video.Version?

1. const box = document.querySelector(".box"); box.style.display = "none";

The box disappeared in about a second later

2. $('.box).hide();

The box remained there. No change on the site.

3 Answers

darryn
darryn
17,355 Points

Hi Zoltan,

For #1 I don't think JavaScript can hide anything until the entire page loads. That's why you see the box flash before it disappears.

For #2 it just looks like you didn't close the single quotes around the box class. A simple typo that we all make.

Steven Parker
Steven Parker
217,571 Points

Good eye! No wonder your avatar is an eagle! :wink:

Thanks a lot! That was the problem...

Steven Parker
Steven Parker
217,571 Points

When you say "about a second later", do you mean a second after you refreshed your browser?

The workspace provide a way to create code for your browser, but changes made there will not be visible on their own. You can only see the results of code changes by first saving the file and then refreshing your browser.

Yes, Steve. After saving the app.js and refreshing the browser or hitting the preview button the box is there. And then a miracle happens and disappears.

Steven Parker
Steven Parker
217,571 Points

We might be able to uncover the mystery if you make a snapshot of your workspace and post the link to it here.

darryn
darryn
17,355 Points

Yeah. Thanks, Steven! Looking forward to when you hit 100k :0)

Steven Parker
Steven Parker
217,571 Points

Well, I seem to have done it. :wink: But now I've discovered a new bug:

six digit bug