开发者

How do I create an array of values from a drop down list?

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(); });

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜