When using the _trigger method to fire events, I fell into a trap that I continue to beat, but I canβt understand correctly.
Basically, if there is more than one instance of my widget, the last widget created on one page takes precedence over all others.
I recognized and successfully used $ .extend to create an object unique to the instance, but I am puzzled by how to approach the following problem:
How to properly use the _trigger method so that it is included for each instance.
(function($) { $.widget("a07.BearCal", { options: { }, _create: function() { _this = this; this.element.click(function() { _this._trigger("testTrig"); }); }, }); })(jQuery);
Example here: http://jsfiddle.net/NrKVP/13/
source share