forked from 0x2620/oxjs
autocomplete, continued
This commit is contained in:
parent
301a9759db
commit
2e6f3cd64b
2 changed files with 61 additions and 24 deletions
|
|
@ -327,15 +327,29 @@
|
|||
]
|
||||
}).addClass("margin").width(96).appendTo(mainPanel);
|
||||
Ox.Input({
|
||||
id: "auto",
|
||||
id: "state",
|
||||
autocomplete: function(value, callback) {
|
||||
callback([
|
||||
"Alabama", "Alaska", "Arizona", "California",
|
||||
"Indiana", "Illinois", "Iowa",
|
||||
"Kansas", "Kentucky",
|
||||
"Michigan", "New York",
|
||||
"Tennessee"
|
||||
]);
|
||||
value = value.toLowerCase();
|
||||
var items = [];
|
||||
states = [
|
||||
"Alabama", "Alaska", "Arizona", "Arkansas", "California",
|
||||
"Colorado", "Connecticut", "Delaware", "District of Columbia", "Florida",
|
||||
"Georgia", "Hawaii", "Idaho", "Illinois", "Indiana",
|
||||
"Iowa", "Kansas", "Kentucky", "Louisiana", "Maine",
|
||||
"Maryland", "Massachusetts", "Michigan", "Minnessota", "Mississippi",
|
||||
"Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire",
|
||||
"New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota",
|
||||
"Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island",
|
||||
"South Carolina", "South Dakota", "Tennessee", "Texas", "Utah",
|
||||
"Vermont", "Virginia", "Washington", "West Virgina", "Wisconsin",
|
||||
"Wyoming"
|
||||
],
|
||||
$.each(states, function(i, state) {
|
||||
if (Ox.startsWith(state.toLowerCase(), value)) {
|
||||
items.push(state);
|
||||
}
|
||||
});
|
||||
callback(items);
|
||||
},
|
||||
placeholder: "State"
|
||||
}).addClass("margin").width(96).appendTo(mainPanel);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue