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 trialNaivedya Bansal
5,483 Pointswhile 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 ?
1 Answer
Jacie Fortune
8,969 PointsI 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.
Bartosz Dittmar
8,620 PointsBartosz Dittmar
8,620 PointsIn a previous step, span inside .spoiler was hidden, so if You append anything to ".spoiler span" it would not be visible. :)