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 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,367 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
231,275 Points

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

Thanks a lot! That was the problem...

Steven Parker
Steven Parker
231,275 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
231,275 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,367 Points

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

Steven Parker
Steven Parker
231,275 Points

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

six digit bug