JSFiddle - React, Tailwind, and code Playground
by Dedi Wibisono
HTML
<table>
<tr>
<td>
<label>Recording Mode:</label>
</td>
<td>
<select id="rec_mode">
</select>
</td>
</tr>
</table>
JavaScript
var options =
[
{
"text" : "Option 1",
"value" : "Value 1"
},
{
"text" : "Option 2",
"value" : "Value 2",
"selected" : true
},
{
"text" : "Option 3",
"value" : "Value 3"
}
];
var selectBox = document.getElementById('rec_mode');
for(var i = 0, l = options.length; i < l; i++){
var option = options[i];
selectBox.options.add( new Option(option.text, option.value, option.selected) );
}