Alert on Every Tag

Alerts with the tag name of every tag in the dom.

by Diego Santana

HTML

<body>
test text
<p>
some paragraph
</p>
<img src="http://example.com/image.jpg">
</body>

JavaScript

var results = [];




var walkDOM = function (node,func) {
        func(node);                     //What does this do?
        node = node.firstChild;
        while(node) {
            walkDOM(node,func);
            node = node.nextSibling;
        }

};
    
    
walkDOM(document.body, function(node) {
    alert(node.tagName);
});