What does the JS $$ code mean?

Possible duplicate:
What does $$ mean in javascript?

I just saw this piece of code.

var buttons = $$('.add-select-row'); 

What does it do? Is this a prototype?

+4
source share
6 answers

Yes, this is a prototype, and one of the first things in the guide:

http://api.prototypejs.org/dom/dollar-dollar/

+2
source

$$ is a variable containing a function (variable names starting with $ are valid in JS).

Multiple frameworks uses $$ as a shortcut to select multiple items using CSS Selector

+2
source

maybe $$ is not a conflicting jquery variable, somewhere in your code:

 var $$ = jQuery.noConflict(); 
0
source

It depends on which libraries are used on this page. Normally jQuery uses $, but some other libraries do the same, so it’s common practice to manually instruct the library to use something else if you have more than one used, which otherwise conflicts.

It seems that jQuery has been told to use $$ through jQuery.noConflict (), which may mean that $ is used by Prototype.

0
source

Yes, it seems that this is a prototype library.

$$ Accepts any number of CSS selectors

0
source

Technically, he does what you want.

For example, it could be jQuery ..

 (function($$) { // code })(jQuery); 

e: Out of context, there is no final answer. You cannot tell your prototype exactly because the prototype uses dollar-dollar.

0
source

Source: https://habr.com/ru/post/1401804/


All Articles