JSFiddle - React, Tailwind, and code Playground
HTML
<div id="test">test</div>
JavaScript
var selectBox = document.createElement("select");
var myDiv = document.getElementById("test");
console.log(myDiv);
var data = [1,2,3,4];
function createSelect(data){
$.each(data, function(key, dbValue) {
var option = document.createElement("option");
option.value = dbValue;
option.text = dbValue;
selectBox.appendChild(option);
});
myDiv.appendChild(selectBox);
}
createSelect(data);