getSiblings() is a helper method I wrote that gets the siblings of an element in the DOM. For example: if you had a list item (
<li>) and wanted to grab all of the other items in the list.
var elem = document.querySelector('#some-element'); var siblings = getSiblings(elem);
Works in all modern browsers, and IE9+. You can extend support back further with polyfills.