How can I log an HTML element as a JavaScript object?

Use console.dir: var element = document.documentElement; // or any other element console.log(element); // logs the expandable <html>…</html> console.dir(element); // logs the element’s properties and values If you’re inside the console already, you could simply type dir instead of console.dir: dir(element); // logs the element’s properties and values To simply list the different property names (without … Read more