We all know it’s good to cache calls to the DOM, so instead of calling $(‘#someElement’) more times, just save it to a var $someElement and use that.
But is it the same when using $(this) inside an event listener for example?
Should $(this) be cached?
Thank you.
Each time you call
$(this)or$(selector)it is a function call to create a new jQuery object… so if you have already created it once, caching will save calling a function to create the same object again