When you click on "Inspect an element" or on an element in the console you can see == $0 next to him.
What does this stand for ? What is the utility ?
You can type $0 in the console and it will output the element but how are you suppose to use it ?
It's useful for debugging and playing around with elements using the Console API. If you select an element in the Elements panel, it gets added to a stack of index references. $0 refers to the last selected element, $1 is the one selected before that, and so on. It remembers the last five elements $0 - $4.
This means you can quickly call functions, or change attributes and properties of these previously selected elements without needing to use a selector like document.getElementById('hplogo'); or $('#hplogo'). Example below:

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With