开发者

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

开发者 https://www.devze.com 2022-12-22 00:02 出处:网络
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:

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

精彩评论

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