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

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.

Screenshot 2021-09-03 at 10.20.40.pngScreenshot 2021-09-03 at 10.21.36.png

It's important to note that it ONLY works in the console. You CANNOT use that alias inside a script.

Resources