DOM (Document Object Model)

What is DOM (Document Object Model)?

The Document Object Model (DOM) is an application programming interface (API) for valid HTML and well-formed XML documents. It defines the logical structure of documents and the way a document is accessed and manipulated.

The DOM is a programming API for documents.
In DOM, document is used in broad sense. Think it as data. In the DOM, documents have a logical structure which is very much like a tree. You can access both HTML and XML documents.

Why the DOM?

With the Document Object Model, programmers can build documents, navigate their structure, and add, modify, or delete elements and content. Anything found in an HTML or XML document can be accessed, changed, deleted, or added using the Document Object Model.
DOM is platform and language independent and implementation-neutral way to specify interface.