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 trialJonathan James
6,998 PointsCreating a spoiler revealer -> Perform: part 1.. Whats wrong with my code?
/*
WHY DOES'NT THE BUTTON APPEAR?
*/
//1. Hide Spoiler
$(".spoiler").hide();
//2. Add button
$(".spoiler").append("<button>Reveal Spoiler!</button>");
3 Answers
Jason Anders
Treehouse Moderator 145,860 PointsIn the code above you were hiding the entire .spoiler but also putting the button there. You should have only been hiding the <span> in the .spoiler.
$(".spoiler span").hide();
This way the button in .spoiler is still visible, but the "Spoiler" in the <span> is hidden.
Sean T. Unwin
28,690 Points`$('spoiler') is still hidden.
Try adding .show()
to the end of the append()
line.
$(".spoiler").append("<button>Reveal Spoiler!</button>").show();
Jonathan James
6,998 PointsWeird because my code is exactly like his in the video , he is not using .show() yet the button shows in the video! I am quite confused here.
Jonathan James
6,998 PointsI started a brand new workspace and rewrote my code and now it works!!! There must have been a semicolon I was missing somewhere or something.. who knows..? =)