mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
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.
This commit is contained in:
parent
e4273ff621
commit
c2c09e8953
@ -43,6 +43,7 @@
|
|||||||
if (!ui.item) {
|
if (!ui.item) {
|
||||||
// remove invalid value, as it didn't match anything
|
// remove invalid value, as it didn't match anything
|
||||||
$(this).val("");
|
$(this).val("");
|
||||||
|
select.val("");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
select.val(ui.item.id);
|
select.val(ui.item.id);
|
||||||
|
1
ui/jquery.ui.autocomplete.js
vendored
1
ui/jquery.ui.autocomplete.js
vendored
@ -79,6 +79,7 @@ $.widget( "ui.autocomplete", {
|
|||||||
self.searching = setTimeout(function() {
|
self.searching = setTimeout(function() {
|
||||||
// only search if the value has changed
|
// only search if the value has changed
|
||||||
if ( self.term != self.element.val() ) {
|
if ( self.term != self.element.val() ) {
|
||||||
|
self.selectedItem = null;
|
||||||
self.search( null, event );
|
self.search( null, event );
|
||||||
}
|
}
|
||||||
}, self.options.delay );
|
}, self.options.delay );
|
||||||
|
Loading…
Reference in New Issue
Block a user