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