Last active
November 7, 2023 21:31
-
-
Save tobiasmuecksch/2011407 to your computer and use it in GitHub Desktop.
JavaScript: Walk the DOM (Go through all DOM Elements)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function walkTheDOM(node,func){ | |
| func(node); | |
| node = node.firstChild; | |
| while (node){ | |
| walkTheDOM(node, func); | |
| node=node.nextSibling; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This contains a spelling error. The
.nextSiblingmethod is spelled with an initial lower casen(not capitalNas in the code above).