javascript - jQuery autocomplete select function not firing -
i writing re-usable wrapper around jquery autocomplete , reason can't select callback work.
given code below, select() function never invoked. have screwed up? there hidden constraint on how specify select callbacks jquery autocomplete widget?
note: half-written. trying select working.
// note: 'input' jquery object. name.space.thingsuggest = function(input) { this.input = input; // set autocomplete widget on given input form. this.input.autocomplete({ source: name.space.thingsuggest.source_url, delay: 500, select: this.select.bind(this) }); this.input.autocomplete('instance')._renderitem = name.space.thingsuggest.renderitem; }; name.space.thingsuggest.source_url = // url name.space.thingsuggest.prototype.select = function(event, ui) { this.input.val(ui.item.label); return false; }; name.space.thingsuggest.renderitem = function(ul, item) { return $('<li>', { value: item.value }) .append(item.label + ' <span>@' + item.username + '</span>') .appendto(ul); }; to clear, autocompletion , _renderitem working expected. suggest callback isn't firing.
i've been staring @ way long...so know it's stupid mismatched brace or something.
thanks in advance!
i mixed select , focus events. because i'm really dumb.
select in fact work in code example above, wasn't triggering because moving focus within list, not clicking/selecting entry.
what wanted do--use callback on list item focus change--requires use of focus callback instead.
Comments
Post a Comment