DOM JavaScript
DOM JavaScript
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
querySelector
Returns the first matching element
similar to Id.
Did you find it
helpfull ?
follow for more
Vikram Singh