Document Object Model is the representation of objects and hierarchy in a document which is generally an HTML or XML document. DOM is the skeleton of a document where changes over DOM generally change the document visually.
What Is DOM (Document Object Model)?
DOM standard is created by W3C in 1998 with the name of
Dom Level 1 which provides the complete model for the entire HTML or XML documents.
DOM Level 2 is published in 200 where the
getElementByID function is introduced.
DOM Level 3 is published in 2004 and XPath support and event handling are added.
DOM Level 4 was published in 2015 by the WHATWG and W3C.
How To Access DOM?
document .We can use different properties of the document object to access DOM objects.
document.body contains the body part of the HTML web page. childElementCount will provide the count of the child elements. document.body.childeren will return all children as HTMLCollection.
document.body.firstChild will return the first HTML child element.
DOM Data Types and Interfaces
Document is the complete DOM document where all of the HTML elements can be accessed.
Node is a node in the DOM hierarchy. Nodes are connected to each other hierarchically where some nodes can be other nodes parent or child. The root node is the Document object.