==$0
Chrome maintains a stack, $
- where
$0
is the selected element,- where
$1
is the last selected element,$2
would be the one that is selected before$1
, and so on.
== $0 chrome
-
Accessing DOM elements from console:
$0
-
Accessing their properties from console:
$0.parentElement
-
Updating their properties from console:
$1.classList.add(...)
-
Updating CSS elements from console:
$0.styles.backgroundColor="aqua"
-
Triggering CSS events from console:
$0.click()
-
And doing a lot more complex stuffs, like:
$0.appendChild(document.createElement("div"))
So clicking on an
HTML
element and getting a reference variable ($0
) in the console