Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the triple dollar sign in jquery?

Tags:

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);​

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?

EDIT

I found this later on:

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

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?

like image 989
esther h Avatar asked Jun 10 '12 22:06

esther h


People also ask

What does $() mean in jQuery?

In jQuery, the $ sign is just an alias to jQuery() , then an alias for a function. This page reports: Basic syntax is: $(selector).action() A dollar sign to define jQuery. A (selector) to "query (or find)" HTML elements.

What does '$' mean in JavaScript?

Updated on July 03, 2019. The dollar sign ($) and the underscore (_) characters are JavaScript identifiers, which just means that they identify an object in the same way a name would. The objects they identify include things such as variables, functions, properties, events, and objects.

What does dollar sign mean in jQuery?

The $ sign is nothing but an identifier of jQuery() function. Instead of writing jQuery we simply write $ which is the same as jQuery() function. A $ with a selector specifies that it is a jQuery selector.

What does $() mean?

Usually when you encounter $() , that means the developer is using a javascript library, such as jQuery. The $ symbol is the namespace for those libraries. All the functions they define begin with $. , such as $.


1 Answers

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

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

Examples:

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

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

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():


Edit to reflect your edit:

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

From the source code:

jQuery.fn = jQuery.prototype
like image 116
gdoron is supporting Monica Avatar answered Oct 17 '22 02:10

gdoron is supporting Monica