几年前我做了一些javascript/jQuery编程,然后我又重新开始了.当时所有jQuery功能都使用美元符号,如果没有导入jQuery库,则没有定义美元符号.

今天,我启动了Firefox,在一个完全空的html文件中,没有javascript库,但美元符号指向一些东西.如果我打开Firefox控制台并键入'$',我会得到"function()".

1) Is it correct that dollar sign was not assigned, a few years back, or do I remember wrong?

2) What is the dollar sign, if not jQuery?

推荐答案

1) 几年前没有指定美元符号是对的,还是我记错了?

那是正确的,而且仍然是正确的.

2)如果不是jQuery,美元符号是什么?

FirefoxChrome实现$$$和其他几个辅助命令.两者都将设置为$$document.querySelectorAll(),如果尚未定义window.$,则将设置为$document.querySelector.

So what you're seeing isn't actually standard JavaScript, but a helper in the developer console of your browser. It's also not jQuery (as long as you're not on a page using jQuery). However, it's behaviour is close to the one of jQuery, concerning that querySelector (for single matches) and querySelectorAll (for multiple matches) give you almost the same strength as the jQuery selector.

Jquery相关问答推荐

在shiny 的datatable列中启用智能搜索

如何根据另一个 radio Select 并切换?

为什么函数没有进入

jQuery .first() 方法返回第一个元素的集合

jquery 淡入淡出元素不显示样式为可见性:隐藏的元素

了解 Backbone.js REST 调用

javascript:检测滚动结束

根据弹出框相对于窗口边缘的 X 位置更改 Bootstrap 弹出框的位置?

如何在我的 WordPress 插件中包含 CSS 和 jQuery?

如何将参数传递给 JavaScript 中的匿名函数?

从父 node 中删除所有子 node ?

如何使用jquery获取点击链接的href?

如何使用 JSON、jQuery 将一组复杂对象发布到 ASP.NET MVC 控制器?

如何在新窗口中打开链接?

如何测试 URL 字符串是绝对的还是相对的?

如何防止使用光标拖动 Select 文本/元素

Jquery live() 与委托()

将数据发布到 JsonP

jQuery中的wait()或sleep()函数?

在页面加载之间保持变量