Skip to content

Commit 9a4eecd

Browse files
galo2099scottgonzalez
authored andcommitted
Autocomplete: changed the search function to always store the last term that was entered by the user. Fixed #5922 - autocomplete: Search not triggered if the first letter is the same as the first letter of a previous erased content
1 parent 04347e5 commit 9a4eecd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

ui/jquery.ui.autocomplete.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,10 @@ $.widget( "ui.autocomplete", {
229229

230230
search: function( value, event ) {
231231
value = value != null ? value : this.element.val();
232+
233+
// always save the actual value, not the one passed as an argument
234+
this.term = this.element.val();
235+
232236
if ( value.length < this.options.minLength ) {
233237
return this.close( event );
234238
}
@@ -242,10 +246,7 @@ $.widget( "ui.autocomplete", {
242246
},
243247

244248
_search: function( value ) {
245-
this.term = this.element
246-
.addClass( "ui-autocomplete-loading" )
247-
// always save the actual value, not the one passed as an argument
248-
.val();
249+
this.element.addClass( "ui-autocomplete-loading" );
249250

250251
this.source( { term: value }, this.response );
251252
},

0 commit comments

Comments
 (0)