Skip to content

Commit c2c09e8

Browse files
committed
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.
1 parent e4273ff commit c2c09e8

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

demos/autocomplete/combobox.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
if (!ui.item) {
4444
// remove invalid value, as it didn't match anything
4545
$(this).val("");
46+
select.val("");
4647
return false;
4748
}
4849
select.val(ui.item.id);

ui/jquery.ui.autocomplete.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ $.widget( "ui.autocomplete", {
7979
self.searching = setTimeout(function() {
8080
// only search if the value has changed
8181
if ( self.term != self.element.val() ) {
82+
self.selectedItem = null;
8283
self.search( null, event );
8384
}
8485
}, self.options.delay );

0 commit comments

Comments
 (0)