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 (2014) Creating a Spoiler Revealer Perfect

How is the button appearing exactly over the spoiler?

Please excuse the noob questions.

  1. How is the button appearing exactly over the spoiler? Is it because of the CSS styling? (Need to watch CSS tutorials after finishing up jQuery!)

  2. Why did we have to hide the text if the button appears over the spoiler? Couldn't we have simply made the button appear over the text and then removed it when the user clicked on it? (and retain the text in the background)

1 Answer

Jose Soto
Jose Soto
23,407 Points

Yes, the button appears over the spoiler because of CSS Styling.

As for the toggling, you are right. You can leave the text there and just add the button on top. However, the point of the exercise is to practice using jQuery to toggle multiple elements. Real world circumstances may require this skill.