Hacker News new | ask | show | jobs
by buckwilson 6006 days ago
I think you kind of missed something. The $ by itself in a variable name doesn't do anything. It's simply a notation to keep your DOM elements (and other variables / objects) separated from your jQuery wrapped elements.

$myDiv = $('#myDiv');

Now I know every time that $myDiv is already wrapped in jQ and I won't make the mistake of wrapping it again $($myDiv) in my code.

1 comments

Yes, I know. My point is that most people won't know/bother doing

$myDiv = $('myDiv');

They'll simply use $('myDiv') all over the place which will be horrible.

so, the complaint is that people who don't understand jquery use it incorrectly/inefficiently?
meh. If you like it use it. Personally I find that code ugly, inefficient and error prone.