Javascript DOM Element Inspector

Description

Javascript DOM Element Inspector

View in separate window


<html>
<head>
    <title>My Object Inspector</title>
</head>/* www .  ja  va 2 s  .  co m*/
<body>
    <div id="myDiv" class="myDivClass">I am a DIV.</div>

    <script>
        function inspectElement(elNode) {
            for (let item in elNode) {
                console.log(item + ": " + elNode[item]);
            }
        }
        
        // Now we write out all the properties of this object to the page.
        inspectElement(document.getElementById("myDiv"));
    </script>
</body>
</html>



PreviousNext

Related