jQuery: Find a selector in both descendants and the element itself

jQuery's find Show archive.org snapshot looks in the element's descendants. It will never return the current element itself, even if the element matches the given selector.

Require the attached file and you can now say:

$('.container').findWithSelf('.selector')

This is sort of like closest Show archive.org snapshot , but it looks in descendants instead of ancestors.

Henning Koch