JSFiddle - React, Tailwind, and code Playground
by Vitaliy
HTML
<select id="some_select"></select>
JavaScript
function createOptions(select, options){
for(var i = 0, l = options.length; i < l; i++){
var option = document.createElement("OPTION");
option.value = options[i].value;
option.textContent = options[i].text;
select.appendChild(option);
}
}
var select = document.getElementById("some_select");
var options = [{value:"1", text:"Option 1"}, {value:"2", text:"Option 2"}, {value:"3", text:"Option 3"}, {value:"4", text:"Option 4"}, {value:"5", text:"Option 5"}];
createOptions(select, options);