Skip to content

Commit

Permalink
Autocomplete: Always reset this.term after a select event, even if th…
Browse files Browse the repository at this point in the history
…e select is cancelled. Fixes #6221 - Autocomplete: Doesn't reset after Select when textbox cleared, if same letters typed in rapidly; source function not triggered in that case.
  • Loading branch information
scottgonzalez committed Oct 25, 2010
1 parent a0847f3 commit 5c67ed2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion ui/jquery.ui.autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,11 @@ $.widget( "ui.autocomplete", {
}

if ( false !== self._trigger( "select", event, { item: item } ) ) {
self.term = item.value;
self.element.val( item.value );
}
// reset the term after the select event
// this allows custom select handling to work properly
self.term = self.element.val();

This comment has been minimized.

Copy link
@grandecomplex

grandecomplex Mar 20, 2013

Thanks so much for helping on the autocomplete plugin. I'm curious why you don't do: self.term = "";

With my custom menu autocomplete, I found if I change that line to (now) this.term = ""; it fixes the dup value in text field bug.

I got this changelist link from this: http://bugs.jqueryui.com/ticket/6221

This comment has been minimized.

Copy link
@scottgonzalez

scottgonzalez Mar 20, 2013

Author Member

I have no idea what bug you're referring to. If you're having problems, please file a new ticket with a reduced test case against the latest version of jQuery UI.


self.close( event );
self.selectedItem = item;
Expand Down

0 comments on commit 5c67ed2

Please sign in to comment.