-
-
Save sergiycheck/badcb854175e511beeb8ccce7e64e8cf to your computer and use it in GitHub Desktop.
traverse child elements dom
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 traverseChildren(elem, tagname) { | |
if (elem.tagName === tagname) cl(elem, elem.tagName); | |
if (!elem.children.length) return; | |
Array.from(elem.children).forEach((child) => { | |
traverseChildren(child); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment