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?
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.
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.
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.
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 $.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With