Say I have this (jqueryUI plugin):
$.widget('ui.someplugin', {
_create: function() {
return $(this.element).click(this._onClick);
},
_onClick: function(e) {
return this._someFunc();
},
_someFunc: function() {
return console.log('someFunc');
}
});
It doesn't work - _onClick receives the DOM element as its scope. I could have the handler reference the plugin again with $(e.target).data('someplugin'), but thats then useless if I want to subscribe to other DOM element events. How do I rejig it so that it does what I want?