From: Robson Braga Araujo Date: Tue, 10 Aug 2010 23:02:50 +0000 (+0800) Subject: Autocomplete: changed the search function to always store the last term that was... X-Git-Tag: 1.8.5~66 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9a4eecdf85bf0a3accd7acb9fead64d6b5aad18e;p=jquery-ui.git 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 --- diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 8380df8ad..4cd1b0548 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -229,6 +229,10 @@ $.widget( "ui.autocomplete", { search: function( value, event ) { value = value != null ? value : this.element.val(); + + // always save the actual value, not the one passed as an argument + this.term = this.element.val(); + if ( value.length < this.options.minLength ) { return this.close( event ); } @@ -242,10 +246,7 @@ $.widget( "ui.autocomplete", { }, _search: function( value ) { - this.term = this.element - .addClass( "ui-autocomplete-loading" ) - // always save the actual value, not the one passed as an argument - .val(); + this.element.addClass( "ui-autocomplete-loading" ); this.source( { term: value }, this.response ); },