DOM Manipulation—Basics

What is DOM?

DOM stands for Document Object Model. In simple terms, the DOM is a tree generated by the browsers to make the complete HTML code visible to the user. The DOM is a standard and language-independent interface that allows any scripting language, such as JavaScript, to modify the contents of a web page dynamically and efficiently by using the DOM tree. Each element or tag in HTML is converted to a node and is attached to its parent node (under which a tag is defined). Each DOM tree has a root node called "Document." Under this node, all the HTML nodes reside.

Understand DOM from HTML code

Let's look at the HTML code shown below, then look at the DOM tree of the HTML code.

Get hands-on with 1200+ tech skills courses.