JavaScript DOM Traversal Methods
23 July, 2022
11
11
0
Contributors
Que- What is Traversing the DOM?
Ans- Everything in an HTML DOM is a node; the entire document, every HTML element, text inside HTML elements, attributes, and comments everything is a node; & navigating between these nodes is known as DOM Traversing.
DOM Relationships
The terms parent, child, and sibling are used to describe relationships.
element.parentElement.nodeName
childNodes
returns all child nodes including text, spaces, and comments.
Where children
only return child elements (not text or comments)1.
2.
javascript
web development
frontend
dom