I am new to NodeJS, I want to use the answers from an array made in NodeJS and add them as options in a select on a HTML document. It is currently returning the error document is not defined
My HTML code is currently:
<select name="controller1" id="controller1ID">
<option disabled selected value> -- Select Robot 1 Controller -- </option>
<option value="sumo_example_one">Example 1</option>
<option value="sumo_example_two">Example 2</option>
</select>
NodeJS code:
var select = document.getElementById('controller1ID');
files.forEach(function (file) {
console.log(file);
var opt = document.createElement('option');
opt.value = file;
opt.innerHTML = file;
select.appendChild(opt)
});