In some core Magento modules I see the $$ signs used constantly when selecting an element. For example, in just 10 lines of code I have the following different selectors:
$('selection-apparently-a-custom-element')$$('#some-element-id')jQuery('#another-element-id')
What is the point of this?
Fabian Schmengler
66.2k25 gold badges191 silver badges422 bronze badges
asked Mar 22, 2016 at 14:04
Lachezar Raychev
1,6127 gold badges26 silver badges45 bronze badges
1 Answer 1
There is still some prototype.js left over from Magento 1, now mixed with jQuery (in noConflict mode)
That means:
$is the prototype selector that returns one element by its id$$is the prototype selector that returns an array of elements by CSS selectorjQueryis what would be$in a pure jQuery environment and returns a jQuery wrapper for an element by CSS selector
answered Mar 22, 2016 at 14:10
Fabian Schmengler
66.2k25 gold badges191 silver badges422 bronze badges
default