0% found this document useful (0 votes)
27 views2 pages

JavaScript DOM Navigation and Node Creation

The document outlines a JavaScript task that involves navigating the DOM to identify text nodes and non-text nodes. For each non-text node found, the script should create a new child node with the class 'hoverNode' and set its innerHTML to the parent tag name. The goal is to enhance the DOM structure by adding these new nodes accordingly.

Uploaded by

Akshat Garg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

JavaScript DOM Navigation and Node Creation

The document outlines a JavaScript task that involves navigating the DOM to identify text nodes and non-text nodes. For each non-text node found, the script should create a new child node with the class 'hoverNode' and set its innerHTML to the parent tag name. The goal is to enhance the DOM structure by adding these new nodes accordingly.

Uploaded by

Akshat Garg
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Webtech Lab-9

Write a JavaScript code that should navigate every element in the DOM, and for each element in the
body determine whether it is a textNode (type 3) or not. Now add to your script code to create a new
child node for every non-text node encountered. This new node should take on the class "hoverNode"
and innerHTML equal to the parent tag name.

You might also like