I need a bit of clarification on jQuery caching. To my understanding, this:
var $element = $('#element');
gives us benefit if we will refer to this element more than once (by refer I mean change it, or listen for an event on it.). Is this correct?
If it is correct, does the following code make any sense, or not, and why?
var $button = $('#submit, #save, #reset');
What I see is that jQuery allows me to do this (hence applying the same nice theme to all 3 buttons), but I cannot find docs anywhere does this help performance in any way.
$buttonis definitely better than using$('#submit, #save, #reset');everywhere (meaning more that 1 instance)