mirror of
https://github.com/jquery/jquery-ui.git
synced 2025-01-07 20:34:24 +00:00
Autocomplete: search against label instead of value when both are provided.
Fixes #5237 - Array matching behaviour of autocomplete should match on label before value. Thanks Simon Cusack.
This commit is contained in:
parent
d6fd76c0c1
commit
602576707e
2
ui/jquery.ui.autocomplete.js
vendored
2
ui/jquery.ui.autocomplete.js
vendored
@ -152,7 +152,7 @@ $.widget( "ui.autocomplete", {
|
||||
// escape regex characters
|
||||
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term), "i" );
|
||||
response( $.grep( array, function(value) {
|
||||
return matcher.test( value.value || value.label || value );
|
||||
return matcher.test( value.label || value.value || value );
|
||||
}) );
|
||||
};
|
||||
} else if ( typeof this.options.source == "string" ) {
|
||||
|
Loading…
Reference in New Issue
Block a user