I'm using this JQuery Autocomplete plugin. It seems that by default it matches from the star开发者_运维百科t, so "foo" would match "fool", but not "bufoon".
I want the matching to occur anywhere and case insensitively, such that "foo" would match
- fool
- bufoon
- Foo Fighter
The options don't appear to be documented anywhere, so I had a look though the source code to figure out if this is possible but couldn't find any obvious way to change the matching algorithm, but I find it hard to believe this isn't supported.
There is an option, matchContains
, that is false by default. Set it to true. Example
Here is a list of options. Be Sure to click the "options" tab
I have done something similar. That's how you can do it:
.autocomplete({
source : function(request, response) {
var term = request.term.toLowerCase();
// generating the array which matches the search term.
response(autocompleteArr);
}
});
精彩评论