Plain JavaScript - Selecting DOM elements
Functions for accessing elements by class, id and other selectors.
Select elements by class name
getElementsByClassName - a fast way of selecting DOM elements by class name in modern browsers. Does not work in IE 8 and below.
jQuery: $('.foo')
Select elements by tag name
getElementsByTagName - a fast and cross browser safe way for selecting DOM elements by tag name, e.g. "div", "a", "span", etc.
jQuery: $('div')
Select an element by ID
getElementById - a fast and cross browser safe way for selecting DOM elements.
jQuery: $('#foo')