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 3

Page not removing button?? check my code

this is my code below. every time i test it out the button stays and nothing happens? i dont know if its a bad connection or my code is wrong?? frying my head!

//prevent spoilerphobes from seeing spoilers //Solution: Hide spoilers and reveal them through user interaction

// 1 - Hide spoiler $(".spoiler span").hide(); // 2 - add a button $(".spoiler").append("<button>Reveal Spoiler Now!</button>"); // 3 - when button pressed $(".button").click(function(){ // 3 - show spoiler $(".spoiler span").show(); // 4 - get rid of button $("this").remove(); });

Cancel last

My bad

eric nzenga
eric nzenga
2,661 Points

Also I believe it should be $(this).remove(); and not $("this").remove(); - no double quotes

1 Answer

Steven Parker
Steven Parker
229,745 Points

By "Cancel last", do you mean you resolved your issue?