How do I get the class of a parent in jQuery? -


how name of class in parent ? have "test stuff" , therefore can it's parent. once have parent. how class property?

<div class="abc">test stuff</div>  

$(this).parent() - gets div class abc

$(this).parent().attr('class') way it. if element potentially have more 1 class, might find .hasclass() method better.


Comments