The Document Object Model (DOM) is an API defined by the W3C to represent and interact with any HTML or XML document. The DOM is a model of an HTML or XML document that is loaded in a web browser. It represents a document as a tree of nodes, where each node represents a portion of the document, such as an element, a portion of text or a comment.
The DOM is one of the most used APIs on the web because it allows code running in a web browser to access and interact with every node in the document. Nodes can be created, moved and changed. Event listeners can be added to nodes. Once a given event occurs all of its event listeners are triggered.