From: Scott González Date: Tue, 20 Jul 2010 17:24:53 +0000 (-0400) Subject: Autocomplete: Clear selectedItem property whenever the user types something. Also... X-Git-Tag: 1.8.3~35 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c2c09e89538ce071efba7ca1e923b5627c236f8c;p=jquery-ui.git Autocomplete: Clear selectedItem property whenever the user types something. Also updated combobox to clear the select element when clearing the text element. Fixes #5453 - Autocomplete: combobox demo doesn't remove invalid values. --- diff --git a/demos/autocomplete/combobox.html b/demos/autocomplete/combobox.html index 4cc98d8f9..6c81b25eb 100644 --- a/demos/autocomplete/combobox.html +++ b/demos/autocomplete/combobox.html @@ -43,6 +43,7 @@ if (!ui.item) { // remove invalid value, as it didn't match anything $(this).val(""); + select.val(""); return false; } select.val(ui.item.id); diff --git a/ui/jquery.ui.autocomplete.js b/ui/jquery.ui.autocomplete.js index 7056e07f5..b9daad86b 100644 --- a/ui/jquery.ui.autocomplete.js +++ b/ui/jquery.ui.autocomplete.js @@ -79,6 +79,7 @@ $.widget( "ui.autocomplete", { self.searching = setTimeout(function() { // only search if the value has changed if ( self.term != self.element.val() ) { + self.selectedItem = null; self.search( null, event ); } }, self.options.delay );