.has()

Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.

.prev()

Get the immediately preceding sibling of each element in the set of matched elements. If a selector is provided, it retrieves the previous sibling only if it matches that selector.