mirror of
https://github.com/devbridge/jQuery-Autocomplete.git
synced 2024-11-25 14:17:45 +00:00
Update demo script.
This commit is contained in:
parent
363764cd3a
commit
985768867f
@ -20,7 +20,7 @@ $(function () {
|
|||||||
response: function (settings) {
|
response: function (settings) {
|
||||||
var query = settings.data.query,
|
var query = settings.data.query,
|
||||||
queryLowerCase = query.toLowerCase(),
|
queryLowerCase = query.toLowerCase(),
|
||||||
re = new RegExp('\\b' + queryLowerCase, 'gi'),
|
re = new RegExp('\\b' + $.Autocomplete.utils.escapeRegExChars(queryLowerCase), 'gi'),
|
||||||
suggestions = $.grep(countriesArray, function (country) {
|
suggestions = $.grep(countriesArray, function (country) {
|
||||||
// return country.value.toLowerCase().indexOf(queryLowerCase) === 0;
|
// return country.value.toLowerCase().indexOf(queryLowerCase) === 0;
|
||||||
return re.test(country.value);
|
return re.test(country.value);
|
||||||
@ -39,7 +39,7 @@ $(function () {
|
|||||||
// serviceUrl: '/autosuggest/service/url',
|
// serviceUrl: '/autosuggest/service/url',
|
||||||
lookup: countriesArray,
|
lookup: countriesArray,
|
||||||
lookupFilter: function(suggestion, originalQuery, queryLowerCase) {
|
lookupFilter: function(suggestion, originalQuery, queryLowerCase) {
|
||||||
var re = new RegExp('\\b' + queryLowerCase, 'gi');
|
var re = new RegExp('\\b' + $.Autocomplete.utils.escapeRegExChars(queryLowerCase), 'gi');
|
||||||
return re.test(suggestion.value);
|
return re.test(suggestion.value);
|
||||||
},
|
},
|
||||||
onSelect: function(suggestion) {
|
onSelect: function(suggestion) {
|
||||||
|
Loading…
Reference in New Issue
Block a user