Selecting items in the DOM
To manipulate the DOM, you need to know how to access it and to obtain references to the elements you want to manipulate.
Note: The Document Object Model as a Family Tree
The DOM is essentially a collection of nodes arranged in a tree. All the nodes are related to each other. They are one big happy family of children, siblings, parents, grandparents, grandchildren, and so on. This essence of a family tree represents the hierarchy of the DOM and is important to understand as you manipulate the DOM through code.
You can access DOM elements through a global object provided by the browser, called document, or through the elements themselves after you obtain a reference to one.
Methods available for selecting DOM elements
|Gets an individual element on the page by its unique id attribute value
|Gets all the elements that have the specified CSS class applied to them
|Gets all the elements of the page that have the specified tag name or element name
|Gets the first child element found that matches the provided CSS selector criteria
|Gets all the child elements that match the provided CSS selector criteria