Document Object Model
Last updated
Was this helpful?
Last updated
Was this helpful?
The Document Object Model (DOM) is a programming interface for HTML and XML document. It provides a structured representation of the document, and defines a way to access the objects from programs or scripts so that they can change the document structure, style and content.
The DOM provides a representation of the document as a structured group of nodes and objects that have properties and methods. In short, the DOM connects web pages to scripts (such as JavaScript) or other programming languages.
A web page is a document. It can either be displayed in the browser window, or as the HTML source. Bot being the same document. It can also be viewed as a document tree, consisting of nodes and objects. This HTML file:
... would give this document tree:
In chapter 13 you will learn how to manipulate the DOM. This chapter is meant as a short introduction to the DOM concept, and makes you think about the HTML document as a tree structure. The content in this chapter is gathered from Mozilla Developer Network, there you can read more about DOM.