if has parent jquery code example
Example 1: jquery if has parent
if ($(this).parents('.last').length) {
// element has an ancestor element with the class "last"
}
Example 2: jquery has parent with class
if ($elem.parents('.left').length) {
}