DOM basics: DOM selection, querySelector, querySelectorAll, getElementById, traversal, manipulation, createElement, appendChild, removeChild, and innerHTML vs textContent
The DOM is the browser's tree representation of the page, and JavaScript can select, traverse, and update nodes through several APIs.
- Selectors return elements or node lists
- DOM manipulation changes the page tree
- `textContent` is safer than arbitrary `innerHTML`
DOM basics: DOM selection, querySelector, querySelectorAll, getElementById, traversal, manipulation, createElement, appendChild, removeChild, and innerHTML vs textContent