Explain The Document Object Model Essay

827 Words Dec 14th, 2016 4 Pages
3. Explain the Document Object Model.

One of the most important matters to know about when using JavaScript is the DOM, or Document Object Model. To describe it simply, it is a way for your HTML and JavaScript to interact and how the JavaScript is able to do its job. It is very important in order to get the code to work.

The Document Object Model is basically a mapping layout model for the HTML. To put it more simply it takes the HTML and treats it kind of like a tree structure. The overall part is the document and within the document is the HTML, and within that is the head and body tags and so on. This shows the layout of the model to look tree-like. These sections can be described in parent, child, and siblings and are known as nodes. The parent nodes would be the HTML tags and the children of that could be the head and body tags. The head and body tags then would be called sibling nodes. These nodes also have various types. There is the element node, text node, attribute node and document node. The document node is the first node encompassing all the rest.

Element nodes are the one that will make up most of your document. These are the tags you use for structure around any information you have. The body, html, paragraph, and even the heading nodes make up these element nodes. You might think that the heading and paragraph tags would be text nodes, but that is not the case.

Text nodes are similar to element nodes because you have to use the same JavaScript to…

Related Documents