Table of Contents
The HTML DOM is a standard object model and programming interface for HTML. It defines:
In other words: The HTML DOM is a standard for how to get, change, add, or delete HTML elements.
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript HTML DOM</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>HTML DOM</h4>
<p id="demo"></p>
<script>
document.getElementById("demo").innerHTML = "Hello World!";
</script>
</body>
</html>

Result View Example
The HTML DOM model is constructed as a tree of objects:
<html><head><body>With the object model, JavaScript gets all the power it needs to create dynamic HTML:
JavaScript can access HTML elements using different methods:
document.getElementById(id) - Find an element by iddocument.getElementsByTagName(name) - Find elements by tag namedocument.getElementsByClassName(name) - Find elements by class name<!DOCTYPE html>
<html>
<body>
<h2>JavaScript HTML DOM</h2>
<p>From w3schools.com, Experiment by Teeratus_R</p>
<h4>Accessing HTML Elements</h4>
<p id="intro">Finding HTML Elements by Id</p>
<p id="demo"></p>
<script>
const element = document.getElementById("intro");
document.getElementById("demo").innerHTML =
"Text from intro paragraph: " + element.innerHTML;
</script>
</body>
</html>

Result View Example
Document in project
You can Download PDF file.