DOM | Document Object Model

As the name suggests, in this article we talk about DOM stands for Document object model (DOM). In DOM we discuss it’s properties and programmatical methods that are used for manipulating the document.

Introduction Document Object Model | What is a DOM

  • In this dom tutorial, DOM or document object model is an application programming interface (API) for HTML and XML (Xtensible Markup Language) documents.
  • It defines the logical structure of the documents and the way that the document is accessed by Javascript DOM.
  • It’s a structure called logical structure because they have no relations between objects.
  • With DOM we have easy access and manipulate the HTML tags, IDs, classes, attributes or properties using predefined DOM methods or functions.
	DOM(Document Object Model)

Structure of the Document Object Model

As the above discussion, the DOM has a logical structure that looks like a tree structure. We prove that statement using a Form a DOM example where we apply DOM methods.

All working the same on the document model in javascript.

DOM (Document object model)

Image Reference: https://www.geeksforgeeks.org

In the above picture, the properties of document objects are accessed by the document object method.

  1. Window Object: Window object is always on the top of the hierarchy.
  2. Document Object: When HTML is loaded on a window it becomes a document object.
  3. Link Object: Link objects represents by link tags in HTML.
  4. Form Object: Form objects defined by Form tag in HTML.
  5. Anchor Objects: It represents <a href=" "> tag.
  6. Form Elements: Form can have many control elements like textarea, checkboxes, radio buttons, etc.

DOM Object Methods

  1. document.write(“string”): writes the given string on the document
  2. document.getElementById(): returns the element having the given id value.
  3. document. getElementsByName(): returns all the elements having the given name value.
  4. document.getElementsByTagName(): returns all the elements having the given tag name.
  5. document.getElementsByClassName(): returns all the elements having the given class name.
http://phpcoder.tech/javascript-array/

Code Example of DOM

See the Pen DOM (Document Object Model) by Bikash Panda (@phpcodertech) on CodePen.

Happy Coding..!

Was this article helpful?
YesNo
My name is Bikash Kr. Panda. I own and operate PHPCODER.TECH, my native place in Odisha. I am a Web Programmer by profession and working on more than 50 projects to date. My passion is working on the web-based project using PHP and relate to all CMS and frameworks which is based on PHP.
Posts created 163

8 thoughts on “DOM | Document Object Model

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top
mariobet - supertotobet - escort -

takip7.com

We are now accepting Guest Posting and creation of Backlinks
This is default text for notification bar