Nutty Peanut Marshmallow
Unleash awesomeness. Private packages, team management tools, and powerful integrations. Get started with npm Orgs »

querysibling

1.1.3 • Public • Published

querysibling

JavaScript's missing querySibling function.

Demo: https://jsfiddle.net/ryanpcmcquen/rhg3crvp/

Given element .zot, which occurs after .foo, you could do:

querySibling.previous('.zot', '.foo');
 
// => Returns `.foo` node.

If you were at .foo and wanted .zot (a next sibling), you could do:

querySibling.next('.foo', '.zot');
 
// => Returns `.zot` node.
 

It is available via npm for new-school kids (es6):

https://www.npmjs.com/package/querysibling

Or RawGit for old-school kids (es5):

https://cdn.rawgit.com/ryanpcmcquen/querysibling/923c4e5f10610b505f22b7af7ba1a54d94df8f0f/index-es5.js

Keywords

install

npm i querysibling

Downloadsweekly downloads

0

version

1.1.3

license

GPL-2.0+

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability