jQuery中的三元符号是什么? [英] what is the triple dollar sign in jquery?

查看:85
本文介绍了jQuery中的三元符号是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试调试某人的代码,并且遇到了这个问题:

I am trying to debug someone's code, and came across this:

$$$.ajax({
    url: ajax_url + param,
    context: $("#formDialog"),
    success: function(data) {
        this.html(data);
        BindPopupFormEvents(this, title, reload);
    }
}, $$$.ajax.PARTAIL_UPDATE, $mainWrapper);​

我们正在使用jquery库,但是我以前从未见过三元符号,也不知道它是什么...有什么建议吗?

We are using the jquery library, but I've never seen a triple dollar sign before and I have no clue what it is... any suggestions?

编辑

我稍后在:

$$$.fn = $$$.prototype = {
    init: function(jQuery, test) {},
    CONST: CONST
};​

我们仅使用jquery库,并且在大多数代码中使用单个美元符号.

We are only using the jquery library, and we use a single dollar sign in most of the code.

您能用简单的英语解释三美元符号的作用吗?

can you explain in plain english what the triple dollar sign is accomplishing, please?

推荐答案

它只是jQuery对象的别名,就像$一样.就这些...

It's just an alias to the jQuery object, just like $. That's all...

输入可以手动完成,也可以使用 jQuery.noConflict()

In can be done by hand or with jQuery.noConflict()

示例:

var $$$ = jQuery.noConflict();
var bla = jQuery.noConflict();

现在$$$bla都是jQuery对象的别名.

Now both $$$ and bla are aliases to the jQuery object.

许多JavaScript库都使用$作为函数或变量名,就像jQuery一样.在jQuery的情况下,$只是jQuery的别名,因此无需使用$即可使用所有功能.如果我们需要在jQuery旁边使用另一个JavaScript库,则可以通过调用$ .noConflict()将$的控制权返回给另一个库:

Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict():


编辑以反映您的

尽管我只看到一小部分代码,但是$$$.fn = $$$.prototype似乎很愚蠢,因为jQuery.fnjQuery.prototype的别名...

Though I see only small portion of the code but $$$.fn = $$$.prototype seems silly as jQuery.fn is an alias to jQuery.prototype...

从源代码开始:

jQuery.fn = jQuery.prototype

这篇关于jQuery中的三元符号是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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