DOM

Stands for "Document Object Model."

The DOM is a programming interface for accessing and modifying the content of webpages and XML documents. It defines the logical structure of a document, treating it like a tree where each branching node represents individual elements. Programs and scripts can access the DOM to read and modify the document's structure, content, and style.

The DOM organizes the structure of HTML and XML files in a hierarchy of objects called "nodes." At the root is the Document node, which represents the document as a whole. Next are the Element nodes that represent individual HTML or XML tags. Element nodes are themselves hierarchical in the way that they're nested. For example, the <html> node is closest to the root of the document and contains both the <head> and <body> nodes, and each of those contains child nodes like <div> and <p> elements.

Each element node in the DOM includes several Attribute nodes that modify its properties. For example, an <img> element node could include attribute nodes for src, alt, width, and height that would allow some JavaScript to modify any of those attributes. Finally, Text nodes contain the text within each element, making up the document contents. Text nodes are the leaves of the tree and have no further levels after them.

The DOM hierarchy showing several elements and how they relate to each other
The DOM hierarchy showing several elements and how they relate to each other

Using JavaScript (or other scripting languages) to access a page's DOM allows you to create dynamic and interactive webpages. For example, event handlers attached to nodes can wait for user interactions like mouse clicks or keyboard input, then modify the page contents in response. JavaScript events can use the DOM to remove existing nodes and add new ones. Scripts can fetch data from a database on a server and use the DOM to insert that data into specific text elements. Scripts can also use the DOM to modify the CSS properties of elements and change the document's appearance and layout.

Updated June 22, 2023 by Brian P.

quizTest Your Knowledge

What is Google's online storage solution called?

A
Google Drive
0%
B
OneDrive
0%
C
SkyDrive
0%
D
iCloud Drive
0%
Correct! Incorrect!     View the Google Drive definition.
More Quizzes →

The Tech Terms Computer Dictionary

The definition of DOM on this page is an original definition written by the TechTerms.com team. If you would like to reference this page or cite this definition, please use the green citation links above.

The goal of TechTerms.com is to explain computer terminology in a way that is easy to understand. We strive for simplicity and accuracy with every definition we publish. If you have feedback about this definition or would like to suggest a new technical term, please contact us.

Sign up for the free TechTerms Newsletter

How often would you like to receive an email?

You can unsubscribe or change your frequency setting at any time using the links available in each email.

Questions? Please contact us.