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


Question 5: Intro to JQuery

Question: Within the anonymous function write the code to remove the element that’s clicked from the document.

My (incorrect) Code:

<script type="text/javascript"> $("#message").hide(); $("#message").show("slow"); $(".removable").click(function(){




How to correct it? The error says Bummer! null.

Thank you!


3 Answers

J.T. Gralka
J.T. Gralka
20,126 Points


Without knowing the exact question you're talking about, it might be hard for me to offer proper advice here, but it looks as if you're not using the proper selector. You might try removing the element by correcting how you're selecting the element you want to remove.

Try using:


instead of


If that's not working, it's probable that I'm making wrong assumptions about the question you're on. It might be helpful for you to link us to the current stage you're on so that we can look at the Code Challenge question in finer detail.

Best of luck!


Sorry about that. The code challenge is the second to last question on the last "Intro to JQuery" Code Challenge. The name of the code challenge is:

Code Challenge: Including jQuery in our Project

And the question is 4/5.

The $(this).remove(); worked like a charm.

I am guessing that this was being passed as an argument for the anonymous function which is why I needed the (). However, it would have still worked without the $, correct?

as in:


If not, why?

Thanks for your help!


Ryan Benson
Ryan Benson
2,069 Points

I'm trying to figure this out as welll, from what I understand,

$() is the jQuery constructor function.

'this' is a reference to the DOM element of invocation.

so basically, in $(this), you are just passing the this in $() as a parameter so that you could call jQuery methods and functions.