Introduction to the DOM
JavaScript programs may inspect and interfere with the document that the browser is displaying through a data structure called the DOM. This data structure represents the browser's model of the document, and a JavaScript program can modify it to change the visible document.
The DOM is organized like a tree, in which elements are arranged hierarchically according to the structure of the document. The objects
representing elements have properties such as parentNode
and childNodes
, which can be used to navigate through this tree.