The Document Object Model (DOM) is a programming API for HTML. It defines the logical structure of documents and the way a document is accessed and manipulated.
With the Document Object Model, programmers can create and build documents, navigate their structure, and add, modify, or delete elements and content. And in this case, we are talking about modifying the content of the HTML elements.
We have used the above 2 methods to access a particular HTML element and make changes or updating the content in the element.