$和$$和有什么不一样? [英] What is the difference between $ and $$?

查看:116
本文介绍了$和$$和有什么不一样?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在经历一些jQuery功能.

I have been going through some jQuery functionality.

任何人都可以让我知道使用$$$之间的区别是什么吗?

Can any one please give me some idea of what the difference is between the use of $ and $$?

推荐答案

在jQuery文档中,没有$$语句. jQuery具有带$字符的默认选择器.也许此脚本使用了另一个javascript库,并且与jQuery有一些冲突.在这种情况下,可以使用jquery.NoConflict来避免此类问题,并设置另一个jquery选择器.

On jQuery documentation there is no $$ statement. jQuery has a default selector with $ character. Maybe this scripts uses another javascript lib and has some conflicts with jQuery. In this case, you can use jquery.NoConflict to avoid this kind of problem, and set another jquery selector.

类似的东西:

var s = jQuery.noConflict();

// something with new jQuery selector
s("div p").hide();

// something with another library's using $()
$("content").style.display = 'none';

如果您的代码具有避免冲突的特性:var $$ = jquery.noConfict();,则可以将$$作为jquery选择器:$$("#element").method();

If your code has somethig like to avoid conflicts: var $$ = jquery.noConfict();, you can use $$ as a jquery selector: $$("#element").method();

有关文档的更多信息: http://api.jquery.com/jQuery.noConflict/

See more on the documentation: http://api.jquery.com/jQuery.noConflict/

这篇关于$和$$和有什么不一样?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆