Sibling elements
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);