0

What is use of dom in javascript?

19th Jul 2016, 10:56 AM
Harshit sharma
Harshit sharma - avatar
2 Answers
+ 1
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."
19th Jul 2016, 12:04 PM
Mahima Rajvir Singh
Mahima Rajvir Singh - avatar
0
Once a web page is loaded a DOM is created. The DOM will read the webpage markup and turn elements/nodes into objects. Javascript is then used to target and manipulate those objects freely using instructions/commands. For example lets take the node/element <body>, i can write some script to say find this element and change its innerHTML or various other things
13th Aug 2016, 4:24 PM
Nicholas Michael Rowe
Nicholas Michael Rowe - avatar