How do I get the name of the class in the parent ? I have “test stuff” and therefore can get it’s parent. Once I have the parent. how do I get the class property?
<div class="ABC">test stuff</div>
$(this).parent() – gets the DIV with class ABC
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
$(this).parent().attr('class')is a way to do it. If the element could potentially have more than one class, you might find the .hasClass() method better.