JSFiddle - React, Tailwind, and code Playground
HTML
<form class="new" method="post" action="/jobs">
<div id="statDiv">Ready to try (poke Test)</div>
<div id="selectDiv"></div>
<input type="button" value="Test" onclick="addInput('selectDiv');" />
<input type="button" value="Reset UI" onclick="resetUI()"/>
</form>
JavaScript
var choices = ["one", "two", "three"];
function addInput(divId) {
var newDiv = document.createElement('div'),
statDiv = document.getElementById("statDiv"),
c = "", // choice
opts = ""; // string
statDiv.innerHTML = "testing...";
for (i = 0; i < choices.length; i += 1) {
c = choices[i];
opts += `<option value="${c}">${c}</option>`;
}
newDiv.innerHTML = `<select>${opts}</select>`;
document.getElementById(divId).appendChild(newDiv);
}
function resetUI() {
var selectDiv = document.getElementById("selectDiv"),
statDiv = document.getElementById("statDiv");
statDiv.innerHTML = "Ready to try again";
selectDiv.innerHTML = ""; // clear the dynamically-created <select>
}