When I used inspect elements in Google Chrome there is always == $0
at the end of the selected element. This is something new and I hadn't see it in the older versions of the Google Chrome:
Asked
Active
Viewed 2.3k times
11

Ashkan Mobayen Khiabani
- 33,575
- 33
- 102
- 171
2 Answers
12
Dev Tools remembers the last five DOM elements (or JavaScript heap objects) that you've selected in the tab (or Profiles panel). It makes those objects available as
$0
,$1
,$2
,$3
, and$4
. $0 returns the most recently selected element or JavaScript object, $1 returns the second most recently selected one, and so on.
See this for more information.

Maria Ines Parnisari
- 16,584
- 9
- 85
- 130
-
So that I can access and use it in the console? what is it useful for? – Ashkan Mobayen Khiabani Jul 06 '16 at 12:35
3
$0 is the current Element You can do $0.addEventListener and other html stuff
$0 is just plain <div id="cBoxCurrent"/> dom node

Piyush.kapoor
- 6,715
- 1
- 21
- 21