Reference $(this).parent with class name of 'x'
66,208
Solution 1
Like this:
$(this).parents('.abc');
or
$(this).parent('.abc');
or
$(this).closest('.abc');
.parent()
and .parents()
are similar except that .parent()
only travels up one level in the DOM tree.
Solution 2
<script>$(this).parent(".abc")</script>
Related videos on Youtube
Comments
-
d-_-b almost 2 years
In jquery, how can I refer to the parent of
$(this)
element with aclass
of'abc'
? -
d-_-b over 11 yearsThank you. I knew it was something simple I was overlooking