Reputation: 16375
$(this).closest(".fieldfilters");
This returns nothing for me. The HTML structure is like this:
<div class="fieldfilters" >
<div class="filtri_ul_list">
<ul>
<li> <a></a></li>
</ul>
</div>
</div>
$(this)
is the <a>
. As far as I understand closest
traverses the DOM up and finds the closest match. Is there a problem with the selector being a class? Why doesn't this work?
Upvotes: 2
Views: 9228
Reputation: 4015
Your usage of .closest() is perfectly fine.
$(this).closest(".fieldfilters");
The most probable cause of your problem is that $(this) is not what you think it is. Check your context to see what 'this' really is.
Upvotes: 2