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 trialRytis Mitkus
7,113 PointsWhy there is two buttons?
Why there appears two buttons ON the 'spoilers' while we do not instruct them to appear exactly there.
I mean we write only one line of code for both spans, but in the code we write only $(".spoiler") not ''spoiler span''.
When there is only one spoiler I kinda get it, but when we do this with two spans it gets harder to understand.
2 Answers
Olga Kireeva
9,609 PointsHi, Rytis. I’ll try to answer your question “Why is there two buttons”. In our code we appended a button to the class spoiler. Class spoiler is assigned to two paragraphs, that’s why we have two buttons. If, for example, we had five paragraphs we had five buttons. In our case, the span is an element inside our paragraphs with class spoiler. Span element contains some text and we use “spoiler span” when we need to do something with this text inside span.
Rytis Mitkus
7,113 PointsOh, got it now! I misslooked - I somehow thought we added class to the body element! My bad, everything is fine now! Thanks for help! :)
Olga Kireeva
9,609 PointsOlga Kireeva
9,609 PointsI forgot to add that all of these five paragraphs must be assigned the class spoiler.