DEV Community

SATHISHKUMAR R
SATHISHKUMAR R

Posted on

DOM in JavaScript?

DOM stands for Document Object Model.

The DOM is a programming interface that allows JavaScript to access, change, add, or remove HTML elements on a webpage.

HTML:

Hello

Click Me

JavaScript:

function changeText() {
document.getElementById("title").textContent = "Hello Sathish!";
}

How It Works:

HTML Page
↓
Browser reads HTML
↓
DOM Tree is created
↓
JavaScript accesses DOM
↓
HTML/CSS can be changed.

Top comments (0)