[jQuery] Eliminating a plugin instance
A typical plugin pattern is
$.fn.plugin = function( options ) {
...
this.each(function() {
var elem = this;
new $.plugin(elem, options);
});
return this;
};
and to call the plugin
$(function() {
$("#my_id").plugin(options);
});
How would I go about deleting the plugin instance so that I can set up a new plugin instance like this:
$("#elem").click(function() {
var new_options = { ... };
$("#my_id").plugin(new_options);
});
If I follow this exactly I end up with two instance of plugin, conflicting with each other so I need to
eliminate the first one before setting up the plugin again. Any ideas ?
thanks
jose