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

Naivedya Bansal
Naivedya Bansal
5,483 Points

while using the append the css selector used is just ".spoiler" and not ".spoiler span".Why so?

while using the append the css selector used is just ".spoiler" and not ".spoiler span".Why is that ?

Bartosz Dittmar
Bartosz Dittmar
8,620 Points

In a previous step, span inside .spoiler was hidden, so if You append anything to ".spoiler span" it would not be visible. :)

1 Answer

I tried adding span selector to the append command, and the button was hidden as well.
<code> //1. Hide spoiler $(".spoiler span").hide(); //2. Add a button $(".spoiler span").append("<button>Reveal Spoiler!</button>"); </code> So, you must put the button outside the span so it will show.