How do I create an array of values开发者_C百科 from a drop down list?
The following should do it. It will create an array from all the values of your select:
var data = $("#theSelect options").map(function() {
return this.value;
}).get();
$('#txtEntry').autocomplete(data);
This works instead:
var data[]; $('#ddlCodes option').map(function(i, option) { data[i] = $(option).val(); });
精彩评论