Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
5 views

DOM JavaScript

Dom js

Uploaded by

hareschaudhary34
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

DOM JavaScript

Dom js

Uploaded by

hareschaudhary34
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

DOM in JS

www.scribbler.live
DocumentObject Model
Think of the DOM as a tree-like structure
that represents the elements of a web
page. It provides a structured way to
access, modify, and interact with the
content and structure of HTML
documents.
Application of DOM
Imagine you have a web page with
various elements like headings,
paragraphs, buttons, and images. The
DOM represents each of these elements
as nodes in a tree structure.
You can use JavaScript to traverse this
tree, find specific elements, and change
their content, styles, or even add new
elements dynamically.
Methods to select a
HTML Element

getElementById

getElementsByClassName

getElementsByTagName

querySelector

querySelectorAll
getElementById

Returns the first matching element


getElementsByClassName

Returns a collection of elements which


can be accessed using [index]
getElementsByTagName
querySelectorAll
Returns a collection of elements which
can be accessed using [index] similar to
class name.

querySelector
Returns the first matching element
similar to Id.
Did you find it
helpfull ?
follow for more

Vikram Singh

Comment Like Share

You might also like