<div class="apple">
<div class="abc">
<input id="go">
</div>
</div>
$("#go").click(function(){
$(this).parent('.apple').hide(); // this doesn't work.
$(this).parent().parent().hide(); //this works
});
I want the .parent('.apple') to work.
From
jQuery.parent()function docs:In other words use
jQuery.parents()instead ofjQuery.parent().