Hugo Lanze Hugo Lanze - 1 month ago 5
HTML Question

How to delete empty select option?

quick question how can i delete or hide an empty select option?

<select id="ho" size="1" style="width: 143px;">
<option>Option 1</option>
<option>Option 2<option>
</select>


Like you can see there are only 2 options, but there is an 3 the empty one how can I delete or hide the 3 option?

Answer

You forgot to close the second option tag. This should work:

<select id="ho" size="1" style="width: 143px;">
             <option>Option 1</option>
             <option>Option 2</option>
</select>