jquery - JQueryUI Widget extend - subscribe to event inside "_create" -
it long time working jqueryui. overriding autocomplete widget , trying internally subscribe 'select' event reason (probably doing wrong) never reaches 'select' handler when item in menu selected:
$.widget( "myautocomplete", $.ui.autocomplete, { _create: function(){ var element = this.element; this._super(); this._on(element, { 'select': function (){ // note: never riches } }); } });
there's no select
event. select
option provided convenience; actual name of event going myautocompleteselect
:
$.widget( "my.myautocomplete", $.ui.autocomplete, { _create: function(){ var element = this.element; this._super(); this._on(element, { 'myautocompleteselect': function (){ // reach } }); } });
the relevant bit in http://api.jqueryui.com/jquery.widget/ under events section:
for widgets, when events triggered, names prefixed widget name , lowercased.
also, missing namespace in widget name ("namespace.myautocomplete"). if tried use should error
Comments
Post a Comment