• Home
  • Today I learned
  • When you select an element on Chrome dev tools element inspector, an alias to it is automatically created

When you select an element on Chrome dev tools element inspector, an alias to it is automatically created

This article was published on Sep 03, 2021, and takes approximately a minute to read.

Chrome Devtools has a lot of nice tricks and learns them all might take some time.

Today I learn that when we select an element in the element inspector, an alias is automatically created to it so you can easily access it via console.

All you need to do is open your element inspector, click in the element you want to have access and you'll see it's marked with a == $0 flag.

From there, you can write in the console $0 and you'll have access to the element you've previously selected.

Element marked with $0 alias
Element marked with $0 alias
Accessing $0 from the console
Accessing $0 from the console
It's important to note that it ONLY works in the console. You CANNOT use that alias inside a script.

Resources