<html>
<body>
<select id="mySelect">
</select>
<p>Click the button to create an OPTION element.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.createElement("OPTION");
x.setAttribute("value", "volvocar");
var t = document.createTextNode("Volvo");
x.appendChild(t);
document.getElementById("mySelect").appendChild(x);
}
</script>
</body>
</html>