jQuery.grep()

Finds the elements of an array which satisfy a filter function. The original array is not affected.

.closest()

For each element in the set, get the first element that matches the selector by testing the element itself and traversing up through its ancestors in the DOM tree.