Manaus
Manaus

Reputation: 451

Is Mootools' $$ a synonym of jQuery's $?

I consider jQuery's $ function very handy. I know MooTools returns an Elements instance, but as a selector are there specific differences? Can you select whatever node on the Dom tree?

Upvotes: 0

Views: 108

Answers (1)

muecas
muecas

Reputation: 4335

Mootools started with both functions $ and $$, then they removed the first one (they keep an alias, so you can also use $) in favor of document.id; $$ can be used exactly as the jQuery version. The main difference between the jQuery $ and the Mootools $$ is that the jQuery version will query the DOM using document.querySelector, while the Mootools version will query the DOM and instances of Mootools classes. To query classes, the class must have the method toElement implemented, and the method must return a reference to the DOM element.

You can learn more on elements and element selection, the dollar and dollars functions in the official Mootools website.

Upvotes: 1

Related Questions