-1

I need to make "none" option as default before select an option from dropdown. My code is given below.

<select name="SelectFlow" id="Flow"> </select>  

<script>
var select = '';

for (i=0;i<=100;i++){   
    select += '<option val=' + i + '>' + i + '</option>';
}

$('#Flow').html(select); 
</script>
Pierre François
  • 5,850
  • 1
  • 17
  • 38
AJINI ASOK
  • 11
  • 2
  • Possible duplicate of [default select option as blank](https://stackoverflow.com/questions/8605516/default-select-option-as-blank) – Germano Plebani Nov 20 '17 at 10:14
  • Of course, it is a duplicate, but all the people looking for a solution will formulate their problem in another way, and perhaps find the duplicated question faster than the original question. – Pierre François Nov 20 '17 at 10:18

1 Answers1

-1

Add one line into your javascript code:

<select name="SelectFlow" id="Flow"> </select>  

<script>
var select = '<option selected="selected">None</option>';

for (i=0;i<=100;i++){   
    select += '<option val=' + i + '>' + i + '</option>';
}

$('#Flow').html(select);
</script>

See: How can I set the default value for an HTML <select> element?

Pierre François
  • 5,850
  • 1
  • 17
  • 38