How to log JavaScript element representations in the console
Have you ever tried logging, say, DOM elements to inspect them in the console using console.log, and then seen something like this:
In some occasions this is enough, but what if you'd like to inspect the JavaScript representation of the element?
This is done easily by using another native function called console.dir instead
var logo = document.getElementById('hplogo');
console.dir(logo);
Neat!
Written by Thomas Lindstrøm
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Html
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#