jquery if has parent
snippet in javascript

jquery if has parent

user7586

if ($(this).parents('.last').length) {
    // element has an ancestor element with the class "last"
}