I'm using the jQuery UI widget factory.
$.widget("myPlugin" , {
options: {
},
_create: function() {
},
instanceVar: "huzzah!"
});
On testing, it looks as though instanceVar is actually part of the prototype. So it is the same across all instances of the plugin.
I can fix this by putting instanceVar into options, like so:
$.widget("myPlugin" , {
options: {
instanceVar: "huzzah!"
},
_create: function() {
},
});
However that seems odd, as instanceVar is just an internal variable for use by the plugin -- not something the user of the plugin should be able to change.
Is there another (better) way to achieve this?
Thanks for your help!