tags:

views:

82

answers:

4

It was my understanding that $() whas a shortcut alias to jQuery() but then I read this iterator. Are they two different objects then?

EDIT: thanks for the replies. Why is there no consistency in the documentation, which uses $() for the most part then switches to jQuery() in the Utilites section? That's what made me confused.

+10  A: 

Try it yourself:

$ === jQuery
Gumbo
+4  A: 

In short - yes, they are.

Elaborating: since $ is used by several JS frameworks jQuery has "no conflict" mode where it can be used via jQuery() var instead (the default one is $).

Eimantas
+1  A: 

yeah synonyms .. your doc page says jQuery.each( object, callback ) .. but you can also do $.each( object, callback )

Scott Evernden
+8  A: 

No, you were right. They're aliases. What that doc was trying to say there is that selecting something then iterating over the jQuery wrapper that results:

$(something).each(function() {...});

is a different function to the one on the bare object (whether you call it $ or jQuery:

$.each(something, function() {...});

which can be applied to any sufficiently array-like sequence, not just jQuery wrapper objects.

bobince