1
0
Fork 0
forked from 0x2620/oxjs

autocomplete, continued

This commit is contained in:
Rolux 2010-02-18 23:15:37 +05:30
commit 8f18c726b6
6 changed files with 21 additions and 3 deletions

View file

@ -330,7 +330,8 @@
id: "state",
autocomplete: function(value, callback) {
value = value.toLowerCase();
var items = [];
var items = [],
regexp = new RegExp("(" + value + ")", "ig"),
states = [
"Alabama", "Alaska", "Arizona", "Arkansas", "California",
"Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida",
@ -349,7 +350,7 @@
} else {
$.each(states, function(i, state) {
if (state.toLowerCase().indexOf(value) > -1) {
items.push(state);
items.push(state.replace(regexp, "<span class=\"OxHighlight\">$1</span>"));
}
});
}