+ 16
With the HTML DOM, JavaScript can access and change all the elements of an HTML document.
When a web page is loaded, the browser creates a Document Object Model of the page.
With the object model, JavaScript gets all the power it needs to create dynamic HTML:
JavaScript can change all the HTML elements in the page
JavaScript can change all the HTML attributes in the page
JavaScript can change all the CSS styles in the page
JavaScript can remove existing HTML elements and attributes
JavaScript can add new HTML elements and attributes
JavaScript can react to all existing HTML events in the page
JavaScript can create new HTML events in the page
"The W3C Document Object Model (DOM) is a platform and language-neutral interface that allows programs and scripts to dynamically access and update the content, structure, and style of a document."
+ 7
A simpler answer could be to say once a web page loads a DOM is created based on the HTML elements on the page.
The DOM reads those elements as objects and places them within a structure. The DOM can then take those individual objects and allow the user to freely manipulate them in a variety of different ways using instructions/commands written in Javascript. Simple as that đ€
+ 4
You might want to read more about js objects and event handling / async coding if you really want to understand the DOM.
+ 1
yes she did a great copy/paste answer
0
Good demonstration mahima Singh (y)
0
very clear answer from Nicholas. HTML document => Object = DOM.
0
Nicholas Michael Rowe, that was a beautiful explanation. please I would like to friend you on Facebook I can learn more from you. thanks
0
When a web page is loaded, the browser creates a Document Object Model of the page. By treating the page (the document) as an object javascript can dynamically access and update its content, structure and style.
.Html tags are seen as the elements of the document object. If e.g. the tag has an ID you can access its value in javascript using the getElementById method of the document object. ( syntax document.getElementById)
Here is the simplest way how to get in JS a value from HTML
html
<input type='text' id='myText' />
JS
var myTextField = document.getElementById('myText');.