113
How to display DOM Element in Console (Chrome)
2021-07-07 - JavaScript
1// JS Tip of the Day
2// How to display DOM Element in Console (Chrome)
3
4// <html>...<p id="hero">I'm Batman!</p>...</html>
5
6console.log($0); // $0 is the active inspected element
7// <p id="hero">I'm Batman!</p>
8
9console.dir($0);
10/*
11p#hero {
12 // ...
13 id: 'hero',
14 // ...
15 innerText: "I'm Batman!",
16 // ...
17 }
18*/
#JStipoftheday