Javascript – Get all the values of a dropdownlist to an array using Javascript

drop-down-menujavascript

how can I get the values of dropdownlist to an array?

Best Solution

var ddlArray= new Array();
var ddl = document.getElementById('ddl');
for (i = 0; i < ddl.options.length; i++) {
   ddlArray[i] = ddl .options[i].value;
}

http://jsfiddle.net/2vtmP/