Skip to content

Instantly share code, notes, and snippets.

@EmmanuelBeziat
Created January 27, 2017 04:01
Show Gist options
  • Save EmmanuelBeziat/eb659b6f316001b99b92782e36ffe58a to your computer and use it in GitHub Desktop.
Save EmmanuelBeziat/eb659b6f316001b99b92782e36ffe58a to your computer and use it in GitHub Desktop.
Get siblings of an element in plain JS
function getSiblings(element) {
Array.prototype.filter.call(element.parentNode.children, function (child) {
return child !== element;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment