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 trialCarl Sergile
16,570 PointsWas this a trick question?
Hey was wondering why I got this answer wrong. I picked that the code removed the h21 element but that wasnt right. My next guess was it removed nothing...?
1 Answer
Steven Parker
231,269 PointsSPOILER ALERT (sort of)
Given the 3 questions that ask about the remove function, only the one that references $("p").prev().remove() actually removes anything.
In the case of $("p").next().remove(), there are no elements in the given HTML following the paragraph. And in the case of $("p").prev().prev().remove(), there is only one element (not two) preceding the paragraph.
Jason Anello
Courses Plus Student 94,610 PointsJason Anello
Courses Plus Student 94,610 PointsWhich question are you referring to? There were 3 that used
.remove()
Are you saying that "nothing" wasn't the correct answer or you are wondering why "nothing" is correct?