Lets say I have an element #parentDiv which I want to hide/show in various functions. Should I save this div to a variable and then reference this variable in my functions such as :
var myDiv = $(#parentDiv);
function hideDiv() { myDiv.hide(); }
function showDiv() { myDiv.show(); }
Or should I 'find' this div in both functions such as:
function hideDiv() { $("#parentDiv").hide(); }
function showDiv() { $("#parentDiv").show(); }
I've been reading up on scope lookup and was wondering performance-wise if it's faster for jquery to search for and element multiple times (across different functions), or if its faster to simply look up the scope.