create javascript array from datalist code example
Example 1: create javascript array from datalist dynamically
var my_list=document.getElementById("months");
my_list.innerHTML = str;
Example 2: create javascript array from datalist dynamically
var str='';
var month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
for (var i=0; i < month.length;++i){
str += '<option value="'+month[i]+'" />';
}
Example 3: create javascript array from datalist dynamically
alert(my_list.options[5].value);