79/95

Select an element or list of elements

Select an element by given ID

<div id="hello" />

document.getElementById('hello');

Select elements by class name

Returns the list of elements that have hello class within a given element:

ele.getElementsByClassName('hello');

Select elements by tag name

Returns the list of span inside a given element:

ele.getElementsByTagName('span');

Select elements by CSS selector

Returns the list of elements that match a given selector:

ele.querySelectorAll('div.hello');

Might be useful