This:
a.attr("id");
since a already a jQuery object.
Although this is a convention used by many for prefix variables that reference a jQuery object using $ .
So:
var $a = $("#someid"); $a.attr("id");
This is only a general agreement, not a requirement. I think this adds clarity, but it can only be because I have long been used to looking for $ .
source share