tags:

views:

144

answers:

3

if someone just write:

    $("#downloadTabs>div").each(function(el) {
        el.setStyle("display", "none");
        el.removeClass('active');
    });

I would know what is this used for. But the actually code I read is

    $$("#downloadTabs>div").each(function(el) {
        el.setStyle("display", "none");
        el.removeClass('active');
    });

There is one more $, and what's this used for ?

+2  A: 

It's probably prototype http://www.prototypejs.org/api/utility/dollar-dollar, as mentioned by James.

Yet jquery could have $$, as stated in this article:

http://onehackoranother.com/projects/jquery/jquery-grab-bag/dom-builder.html

Jan Jongboom
jQuery doesn't have setStyle() though, that would be css().
James Wheare
+2  A: 

It might well be that to avoid conflicts with some other library, someone working on your codebase has added a line like this:

var $$ = $.noConflict();

$$ is not mentioned in the jQuery source code as far as I can see...

nickf
+10  A: 

The second example is not jQuery, it's MooTools. The $$ can take a CSS selector to return a set of elements just like the $ function in jQuery: http://mootools.net/docs/core/Element/Element#dollars

prototype.js also has a very similar $$ function that's a shortcut to getElementsBySelector: http://www.prototypejs.org/api/utility/dollar-dollar

James Wheare
does prototype/mootools have the `$$.each()` ?
nickf
Yes
Jan Jongboom
Ah yeah it's MooTools. The difference being removeClass is called removeClassName in prototype.
James Wheare