LukeJonGibson LukeJonGibson - 1 year ago 122
HTML Question

Easy way to add drop down menu with 1 - 100 without doing 100 different options?

I was just wondering if there was a simple shortcut to add options to a dropdown menu for the numbers 1 to 100 instead of having to do the following:

<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>
<option value="6">6</option>
<option value="7">7</option>

etc. all the way to 100?


Answer Source

Not with plain HTML I'm afraid.

You could use some jQuery to do this though:

    var $select = $(".1-100");
    for (i=1;i<=100;i++){

-- SEE DEMO --

You can download jQuery here

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download