views:

46

answers:

4

regardless of parent/child-relations etc, how do I find the node closest above $(this) node with a certain property, for example class="field"?

+1  A: 

This should do the trick (assuming .field is a parent of this):

$(this).closest(".field");
ScottE
+1  A: 
$(this).closest(".field");

Documentation: http://api.jquery.com/closest/

SteD
A: 
$(this).parents(".field:first")
Tom Brothers