Skip to main content Accessibility Feedback

console.dir()

The wonderful Remy Sharp shared an awesome browser console trick this week.

You know that console.log() in devtools lets you see the element. Did you know console.dir() lets you inspect the element DOM properties?

To see it in action, open up any website, open up developer tools, and click over to the “Console” tab. Then copy/past this in and hit enter.

console.dir(document.body);

Instead of seeing the element, like you would with console.log(), you’ll get back a list of all of the properties on that element. Cool!