DOM
When a web page is loaded, the browser creates a Document Object Model of the page.
Document selectors -
- Finding HTML elements by id - document.getElementById(’idname’)
- Finding HTML elements by tag name - document.getElementByTagName(’p’)
- Finding HTML elements by class name - document.getElementByClassName(’’)
- Finding HTML elements by CSS selectors - document.querySelectorAll(’p.classname’) - used to select multiple combinations
- Finding HTML elements by HTML object collections
HTML dom is an object modal
- The HTML elements as objects
- The properties of all HTML elements
- The methods to access all HTML elements
- The events for all HTML elements
<html>
code
<body>
<p id="demo"></p>
<script>