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

Posted . Visible to the public.

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
Last edit
Henning Koch
Attachments
Keywords
reverse, closest
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra dev (2016-06-09 15:38)