This is a little function to help us cache the jQuery selector(jQuery object).
Everybody knows cache the jQuery selector is a good practice.
var $button = ; $button; $button;
However, sometimes it's a little cumbersome...
So you can cache a selector by using this little util function like this:
$$button;
Installation
To install via the npm, enter the following:
npm install jquery-selector-cache
or just use the src/jquery-selector-cache.js
from git repository.
Feel free to use either AMD or CommonJS to require this function.
Usage
To cache a jQuery object simply by replacing $
with $$
.
if === console;;
To update the cache, pass true
to the second argument.