问题
Suppose in the source of jQuery autocomplete I have a word like SELINA RISEWA MIL.
But if I type SELINA MIL jQuery autocomplete doesn't return that option. How can I change that?
回答1:
You have to implement this in your search logic from where you are returning your JSON response containing the suggestions.
回答2:
You can use Regular Expressions-- say like this
$('#elem').autocomplete({
source: function(request, response) {
var matcher = new RegExp( $.ui.autocomplete.escapeRegex(request.term, ""));
var data = $.grep( array, function(value) {
return matcher.test( value.label || value.value || value );
});
response(data);
}
});
来源:https://stackoverflow.com/questions/15428071/how-can-i-make-jquery-autocomplete-search-in-all-the-words-seperated-by-a-whites