I think because your function receives the event as an argument, and you need event.target.
$('a.menu_filter_select').click(function(evt) { var parent_filter = $(evt.target).closest('tr');
I also recommend using closest instead of parent , as your code will work even if someone puts <b> , <i> or <span> around the anchor. I also use find instead of child .
Edit: In fact, this in FireFox refers to a binding object, but I cannot be sure that it is implemented in the same way in other browsers. BUT event.target can refer to a child if, say, a document looks like this:
<a><b>some text</b> other text</a>
then this event handler can output various elements:
$(a).click(function(event) { console.log(this, event.target); });
Try to run this code in FireBug, see how it works.
source share