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

CSS jQuery Basics (2014) Creating a Spoiler Revealer Perform: Part 1

Spoiler hide not working

I can't get past the first step because my code isn't correct for some reason:

$(".spoiler span").hide();

thanks

Hey Adam,

The easiest way for us to see your full problem is to share a snapshot of your workspace. If you don't know how to do that, check out this forum post: http://www.teamtreehouse.com/forum/workspace-snapshots

6 Answers

David Richied
David Richied
18,057 Points

I pasted $(".spoiler span").hide(); into my finished project, and it still seems to be working. There must be some error further on. Did you try pressing Ctrl+Shift+J while you're on the webpage to open the JavaScript console to see if there were any errors? I also experienced the same problem that you did with work spaces, but it's working for me, now.

I looked at the course problem and it says it wants you to append a button onto the .spoiler class. Is this what you are trying to do?

All you would need to do for that is select .spoiler with jquery $(".spoiler") and then .append("Your button code goes here").

Does that help?

Sorry for the confusion. It's not a quiz or objective. It's from Perform: Part 1 @ 1:30.

Also, every Workspace I open has the exact same content, so something is messed up. Still does it after I cleared cache.

Ah ok. So what is telling you that your code isn't correct? The console? Is the button just not hiding when you preview it?

Also are you opening the workspace from the course? Or just a new workspace?

(Your code should hide the button because it's correctly formatted)

Thanks, Caleb and David. The text was supposed to hide. I didn't move on to the button part yet.

I didn't remember to do the Ctrl+Shift+J, but I should have tried that first.

I consider this solved. Thanks again.

Using Ctrl+Shft+J I did find the problem. I thought I had commented out everything, but there was one bracket that I missed. Sorry about that.

Ian Kilpatrick
Ian Kilpatrick
11,117 Points

I looked in another post regarding this course, I made sure to include the parentheses after hide: $(".spoiler span").hide();

Also, I used an updated JQuery from the CDN: <script src="https://code.jquery.com/jquery-1.12.0.min.js"></script>

This seems to work for me.