Walking the DOM


For all nodes:

parentNode

childNodes

firstChild

lastChild

previousSibling

nextSibling

For element nodes only:

parentElement

children

firstElementChild

lastElementChild

previousElementSibling

nextElementSibling


Search for nodes in DOM


querySelector

querySelectorAll

getElementById

getElementsByName

getElementsByTagName

getElementsByClassName

elem.matches(css)

elem.closest(css)

elemA.contains(elemB)


DOM Properties