Skip to content

Instantly share code, notes, and snippets.

@setkyar
Last active August 29, 2015 14:04
Show Gist options
  • Save setkyar/b08a44155e941e2d0d9e to your computer and use it in GitHub Desktop.
Save setkyar/b08a44155e941e2d0d9e to your computer and use it in GitHub Desktop.
Looping For Option
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
var select = document.getElementById("demo");
var i=0;
for(i=1;i<=5;i++){
select.options[select.options.length] = new Option(i,i);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment