Animations
API
Arrays
Async
Basics
Challenges
Classes
Console
Dates
Debugging
DOM Elements
DOM Methods
DOM Properties
Event Listeners
Flow Control
Forms
Functions
Global Functions
JSON
Keywords
Libraries (3rd party)
Math
Modules
Objects
Snippets
String
Types
Widgets
Window Object
The HTML DOM (Document Object Model
) is the owner of all other objects in your web page.
If you want to access any element in an
HTML page, you always start with accessing the document object.
The DOM defines a standard for accessing HTML and XML documents.
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.
Below are some examples of how you can use the document object to access and manipulate HTML.
document.getElementById("{id}");
document.getElementsByTagName("{name}");
document.getElementsByClassName("{class}");
Changing HTML Elements Examples
document.getElementById("demo1").innerHTML = "Goodbye World";
document.getElementById("demo1").setAttribute("class","text-success");
document.getElementById("demo1").style.fontSize = "50px";