When/why to prefix variables with “$” when using jQuery? [duplicate]

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);

Leave a Comment