I have a dialog element, that has a select
tag with id of dropdown
. I also have an array of strings called fileNames
. I want to add each item in filenames
as an option
in the dropdown.
When I create an option
element, fill it with the proper attributes and log it to the console, it looks normal. However, when I try to append it to the select
element, I get “torq::ui::TorqComboBoxItem” as the innerText, and I believe that the value is empty.
Here is my code:
fileNames.forEach((name, i) => {
let option = document.createElement('option');
option.innerText = name;
option.value = fileList[i].name; /*Get file names from somewhere else*/
document.getElementById('dropdown').appendChild(option);
})