What is == $0 in developer tool after the end of e

2019-08-10 11:03发布

This question already has an answer here:

enter image description here

I want to know what is the == $0 in developer tool, it is marked by red in the screenshot. I found this == $0 in code of every website in developer tool and want to know what is this?

2条回答
一夜七次
2楼-- · 2019-08-10 11:43

$0 refers to the current selected element in your source.

It means that you can access to this element in the DevTools console by simply typing:

$0

From there, you can do whatever you like with this element, by using Javascript DOM API.

See Chrome DevTools reference

查看更多
迷人小祖宗
3楼-- · 2019-08-10 12:01

I personally am not seeing this, but $0 usually refers to the element currently inspected.

Try it out by right-clicking this comment and choose "Inspect element" in Google Chrome. If you pop over to the console and type out $0, it will select the element in the page and print it out in the console.

查看更多
登录 后发表回答