Answers for "create javascript array from datalist dynamically"

0

create javascript array from datalist dynamically

<input name="month" list="months" >
<datalist id="months" >
</datalist>

<script language="javascript">
var str=''; // variable to store the options
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]+'" />'; // Storing options in variable
}
var my_list=document.getElementById("months");
my_list.innerHTML = str;
</script>
Posted by: Guest on October-05-2020
0

create javascript array from datalist dynamically

var my_list=document.getElementById("months");
my_list.innerHTML = str;
Posted by: Guest on October-05-2020
0

create javascript array from datalist dynamically

alert(my_list.options[5].value);
Posted by: Guest on October-05-2020
0

create javascript array from datalist dynamically

<input name="month" list="months" >
<datalist id="months" >
</datalist>
Posted by: Guest on October-05-2020
0

create javascript array from datalist dynamically

var str=''; // variable to store the options
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]+'" />'; // Storing options in variable
}
Posted by: Guest on October-05-2020
0

create javascript array from datalist dynamically

var my_list=document.getElementById("months");
alert(my_list.options.length);
Posted by: Guest on October-05-2020

Code answers related to "create javascript array from datalist dynamically"

Code answers related to "Javascript"

Browse Popular Code Answers by Language