Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the meaning of == $0 that is shown in inspect element of google chrome for the selected element [duplicate]

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:

enter image description here

like image 950
Ashkan Mobayen Khiabani Avatar asked Jul 06 '16 12:07

Ashkan Mobayen Khiabani


People also ask

What does == $0 mean in inspect?

It's the last selected DOM node index. Chrome assigns an index to each DOM node you select. So $0 will always point to the last node you selected, while $1 will point to the node you selected before that. Think of it like a stack of most recently selected nodes.

What is the inspect element on Google Chrome?

Inspect element is one of the developer tools incorporated into the Google Chrome, Firefox, Safari, and Internet Explorer web browsers. By accessing this tool, you can actually view — and even edit — the HTML and CSS source code behind the web content.

How do I inspect hidden elements in Chrome?

VIEW HIDDEN ELEMENTS: The extension makes visible those elements hidden by the "display:none", "type=hidden", and "visibility=hidden" attributes / styles. To do this hit LazySec's "Show Hidden Elements" button.

What is the code for inspect element?

Press CMD + Option + I on a Mac, or F12 on a PC to open Inspect Elements without clicking anything.


1 Answers

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.

like image 178
Maria Ines Parnisari Avatar answered Nov 09 '22 23:11

Maria Ines Parnisari