1

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 ?

1
  • looks like mootools to me (the each part) Commented Sep 22, 2009 at 7:51

3 Answers 3

11

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

Sign up to request clarification or add additional context in comments.

2 Comments

does prototype/mootools have the $$.each() ?
Ah yeah it's MooTools. The difference being removeClass is called removeClassName in prototype.
2

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...

Comments

2

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

1 Comment

jQuery doesn't have setStyle() though, that would be css().

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.