Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var allDivsinDom = document.getElementsByTagName('div'); //Array of all divs
- var allAnchorinDom = document.getElementsByTagName('a'); //Array of all a
- ....
- function readHTML(node) {
- var i, child;
- if (node.nodeType == 1) { // only tags
- for (i = 0 ; i < node.childNodes.length ; ++i) {
- child = node.childNodes[i];
- // do something with node
- window.console.info(child.tagName);
- readHTML(child);
- }
- }
- }
- readHTML(document.body);
Add Comment
Please, Sign In to add comment