I'm trying to populate a drop down menu with a javascript array. I can get individual elements to show up but not the entire array. I'm sure this question has been asked before, but can't find any references. Any help would be appreciated.
var sex=["male","female", "unknown"];
for (i=0;i<sex.length;i++){
var opt = document.createElement("option");
document.getElementById("m").innerHTML=sex[i];
}
The html is:
<form name = "demo">
<table id = "demo">
<th>Demographics</th>
<tr><td>Sex</td><td><select><option id="m"></option></select></td></tr>
</table>
</form>