The $ dollar sign

Solution 1:

$ is just a name - names in JavaScript can contain dollar signs, and can consist of just a dollar sign.

Whether you use a dollar sign in your name isn't relevant to jQuery - there's nothing special about the dollar sign, except that jQuery defines a function called $.

Solution 2:

I've seen it done both ways. All you are doing is creating a variable with the name '$selector', so they are functionally equivalent. The nice thing about it is that it does make them easy to pick out as jQuery objects.

Solution 3:

The cash sign is just an alias for the jQuery function. Starting the variable name with $ has no effect on that variable.

It is customary though, especially in jQuery plugin development, to use variables already wrapped in jQuery with a cash sign, so you know you can call jQuery methods, without having to wrap them.