Skip to content

like $.find, but only returns the innermost element/s that match

Notifications You must be signed in to change notification settings

baldwicc/jquery-findInnermost

Repository files navigation

jquery-findInnermost Build Status

like $.find, but $.findInnermost

Installation

bower install jquery-findInnermost --save

Usage

var data = [
'      <div id="parent">',
'        <div class="child child-1">',
'          <div class="child child-2">',
'            whoaa!',
'          </div>',
'          <div class="child child-3">',
'            <div class="child child-4">',
'              whee!',
'            </div>',
'          </div>',
'        </div>',
'      </div>',
].join('\n');

// will return 4 elems 😦
$(data).find('.child');

// will return 2 elems - child-2 and child-4 😄
$(data).findInnermost('.child');

// and of course, it works in the dom
$('body').append(data);
$('#element').findInnermost('.child');

License

MIT © baldwicc

About

like $.find, but only returns the innermost element/s that match

Resources

Stars

Watchers

Forks

Packages

No packages published