DOM Traversal Lab
Medium
9
61.0% Acceptance
In this lab, you will be working with the Document Object Model (DOM) traversal methods to navigate and manipulate HTML elements. You will perform operations like finding parent, child and sibling elements, and filtering elements based on some conditions.
Concepts
- Parent, child, and sibling elements
- DOM Traversal Methods:
- parentNode
- nextSibling
- previousSibling
- firstChild
- lastChild
Challenges
- Select an element with id
parent
and find its first child. - Select an element with id
child
and find its parent node. - Find the next sibling of an element with id
firstSibling
. - Find the previous sibling of an element with id
lastSibling
. - Use the
Array.from
method to convert NodeList of classitems
to an array, and filter out the elements with the class nameactive
.