Created
January 27, 2017 04:01
-
-
Save EmmanuelBeziat/eb659b6f316001b99b92782e36ffe58a to your computer and use it in GitHub Desktop.
Get siblings of an element in plain JS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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