From my understanding, setting the jQuery object to var caches the object, and therefore it will not rebuild the jQuery object every time you need to use it to do somehting.
A few articles about this, here is the first I found google
I think, however, $('#bar') refers directly to document.getElementById ('bar'), so it doesn't build too much and therefore is pretty fast, but faster when you have an array of objects. $('.class tagType')
source share