check if element 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 get the parent node
$(selector).parent(filter)