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 Perform: Part 1

Pongpon Tienthong
Pongpon Tienthong
7,815 Points

My browser loaded all the html code before jQuery hided the spoiler. So, the message was revealed. What should I do?

My browser loaded all the html code before jQuery hided the spoiler. So, the message was revealed. What should I do?

1 Answer

Hey Pongpon,

An easy fix to this is to simply hide the spans within the spoiler (aka the spoilers themselves) in the CSS. That way, they will only show up once the button has been clicked. Here is my selector in the CSS stylesheet:

.spoiler span {
  display: none;
  color: #dae1e4;
}

You're welcome! I got 10 emails this morning saying this answer was upvoted lol