1
0
Fork 0
forked from 0x2620/oxjs

autocomplete, continued

This commit is contained in:
Rolux 2010-02-19 00:38:41 +05:30
commit 07ec8f30f7
2 changed files with 7 additions and 5 deletions

View file

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