create javascript array from datalist dynamically

Solutions on MaxInterview for create javascript array from datalist dynamically by the best coders in the world

showing results for - "create javascript array from datalist dynamically"
Emil
24 Mar 2016
1<input name="month" list="months" >
2<datalist id="months" >
3</datalist>
4
5<script language="javascript">
6var str=''; // variable to store the options
7var month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
8for (var i=0; i < month.length;++i){
9str += '<option value="'+month[i]+'" />'; // Storing options in variable
10}
11var my_list=document.getElementById("months");
12my_list.innerHTML = str;
13</script>
14
María Alejandra
30 Jan 2018
1<input name="month" list="months" >
2<datalist id="months" >
3</datalist>
Ana Paula
20 Apr 2016
1var str=''; // variable to store the options
2var month = new Array("January","February","March","April","May","June","July","August","September","October","November","December");
3for (var i=0; i < month.length;++i){
4str += '<option value="'+month[i]+'" />'; // Storing options in variable
5}
Abram
21 Sep 2020
1var my_list=document.getElementById("months");
2alert(my_list.options.length);
Montserrat
23 Jun 2016
1var my_list=document.getElementById("months");
2my_list.innerHTML = str;
Weston
07 Aug 2019
1alert(my_list.options[5].value);