Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
155
rated 0 times [  157] [ 2]  / answers: 1 / hits: 40162  / 13 Years ago, thu, june 2, 2011, 12:00:00

Possible Duplicate:

Why would a javascript variable start with a dollar sign?






I see people using the dollar sign in front of variables when using jQuery. Is there any reason behind this? I'm I missing something basic or is it just a common practice?


More From » jquery

 Answers
13

It's a common reference to a jQuery wrapped object. It makes reading the code easier to know which variables are jQuery wrapped.



//Item has been cached for later use in the script as a jQuery object.
var $item = $(this);

[#91911] Wednesday, June 1, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
karladaijahf

Total Points: 78
Total Questions: 123
Total Answers: 89

Location: Liechtenstein
Member since Wed, Dec 8, 2021
3 Years ago
;