Skip to content

Instantly share code, notes, and snippets.

@wking-io
Last active October 10, 2018 12:32
Show Gist options
  • Save wking-io/4aa0e683ba01493d2a2cdf6bac064045 to your computer and use it in GitHub Desktop.
Save wking-io/4aa0e683ba01493d2a2cdf6bac064045 to your computer and use it in GitHub Desktop.
How do I get all the siblings of an element?
const getSibs = (el) => Array
.from(el.parentNode.childNodes)
.filter(child => child.nodeType == 1 && child != el);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment