What is == $0 in developer tool after the end of every line of code? [duplicate]

我只是一个虾纸丫 提交于 2019-12-11 12:17:47

问题


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?


回答1:


$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




回答2:


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.



来源:https://stackoverflow.com/questions/37115354/what-is-0-in-developer-tool-after-the-end-of-every-line-of-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!