jquery - 为什么 $() 在谷歌工作?

标签 jquery html google-chrome

<分区>

我尚未在我的HTML页面上包含jQuery文件,但是仍然 $()在Google Chrome Console中起作用,并且它是选择器,为什么?但是,jQuery 的功能不起作用,但我想知道为什么 $() 在 google chrome 控制台上工作?

最佳答案

Chrome devtools 定义了一组有用的快捷方式来查询 DOM。其中包括 $$$。来自docs :

$(selector) returns the reference to the first DOM element with the specified CSS selector. This function is an alias for the document.querySelector() function.

同样,$$(selector)document.querySelectorAll(selector) 方法的别名。

所以它与 jQuery 无关,它们只能在开发者控制台中工作。

关于jquery - 为什么 $() 在谷歌工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48564626/

相关文章:

php - 如何使用 php 获取网站的 css

html - css transform scale - 重叠在左边但不在右边

javascript - 在javascript div中自动滚动

jquery - Ajax .load() 后加载的内容会丢失字符集(UTF-8),但仅限于 FireFox 和 IE。 Chrome 和 Opera 运行良好

html - 使用 CSS3 过渡导航时意外的 CSS 行为

node.js - 更改 SSL 证书的域 - 如 Charles Proxy

javascript - 如何使用 JavaScript 截取 div 的屏幕截图?

javascript - 如何从书签加载外部 css、js 并将 div 附加到 DOM?

javascript - fullCalendar 用户事件

Jquery 游戏 - 如何将对象保持在边界内