A jQuery plugin instance is created inside a certain function. What is the recommened way to store it so the the returned plugin can be used inside another function?
code:
(function($){
$.fn.myplugin = function(){
...
return this;
};
}(jQuery));
function f(){
var pluginInstance = $('#selector').myplugin ();
...
}
function g(){
//I want to use pluginInstance here.
}