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 trialsteve thomas
9,753 PointsChallenge Task 2 of 2 On line 13, remove the button from the DOM. $(this).remove(); not working!
//1, Hide spoiler $(".spoiler span").hide(); //2, Add a button $(".spoiler").append("<button>Reveal Spoiler!</button>"); //3, When button pressed $("button").click(function();{ //3.1, Show spoiler $(".spoiler span").show(); //3.2, Get rid of button $(this).remove(); });
4 Answers
steve thomas
9,753 PointsThank you, Singh,,,,,it finally worked with $(this).remove(); code!
gagan singh
Full Stack JavaScript Techdegree Student 12,889 Pointssteve try posting my code on there see if it passes
steve thomas
9,753 PointsBummer! You didn't select $(this)
which is, in this context, the button you clicked on.
after posting your code of $("button").remove();
barnetobeka
Courses Plus Student 10,895 PointsTarget the button its self
$("button").remove();
steve thomas
9,753 Points$("button").remove(); NOT working either after trying this statement
Rajnish Kumar
41,092 Points$(this).remove();
gagan singh
Full Stack JavaScript Techdegree Student 12,889 Pointsgagan singh
Full Stack JavaScript Techdegree Student 12,889 Points$(".spoiler span").hide(); //2, Add a button $(".spoiler").append("<button>Reveal Spoiler!</button>"); //3, When button pressed $("button").click(function(){ //3.1, Show spoiler next to the button clicked $(this).show(); //3.2, Get rid of button $(this).remove(); });