stulk stulk -4 years ago 128
Javascript Question

setting an option value empty in a dynamically changing select list

How can I modify this code:

so that the '--None--' selections are outputted as

<option value="">--None--</option>

instead of

<option value="--None--">--None--</option>


Answer Source

Didn't put much time into your question, So here's a simple fix.

if(programs[i][1] == '--None--') {
    var opt = new Option(programs[i][1],'' );
    opt = new Option(programs[i][1]);

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