What Is DOM?

What Is DOM?

·

2 min read

The full form of DOM is the Document Object Model. The other thing that really comes to mind when it comes to dom is JavaScript. When we design a website with HTML and render it in the browser, all the elements inside that HTML template are considered as a JavaScript object. This JavaScript object is called the document object model.

Now the question arises why this document object model is needed. The question is very natural. The simple answer is that when we want to add interactivity to a website, we need to do so with the help of the document object model. And this work is called dom manipulation. For example, if you click a button on the website, something will happen or some images will go from left to right or there will be a slider or if you click a button, the website will turn on dark mode. Since the document object model loads the whole HTML as a JavaScript object, we can select a specific element of HTML with the help of JavaScript and click on that element to tell what will happen with JavaScript. As a result, when an element changes on the website, the document object model changes. As a result, the browser will reload the website as a new document object model so that we can see the updated content on the website.

There are many ways to manipulate Dom. . We can do it with raw javascript if we want. There is also a popular library for Dom manipulation called JQuery. You can easily do the job of DOM Manipulator by writing a few codes using JQuery. From this website “api.jquery.com" you can learn JQuery and use JQuery to add a lot more interactivity to the website.