How to convert this javascript code to jquery ?
var ddlArray= new Array();
var ddl = document.getElementById('ddl');
for (i = 0; i < ddl.options.length; i++) {
ddlArray[i] = ddl .options[i].value;
}
I think one can convert ddl = document.getElementById('ddl'); to ddl = $('#ddl'); but what can be done to the loop ?
var ddlArray = [].map.call(document.getElementById('ddl').options, function(opt){return opt.value;});. Note that you'll need a polyfill for .map for IE8, there are libraries to give IE 8 ES5 features.