Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript What am I doing wrong? Reply To: What am I doing wrong?

#146097
gowda24
Participant

try this out

<

pre>`$(document).ready(function() {
var options = new Array();
options [0] = "one";
options [1] = "two";
options [2] = "three";
options [3] = "four";
options [4] = "five";
options [5] = "six";
</code></pre>

<p>for (var i = 0; i < 6; i++)
{<br />
var newItem = document.createElement('OPTION');
newItem.text = [i];
newItem.value= [i];<br />
document.getElementById("demo").add(newItem);</p>

<p>}
});`