Reputation: 473
i have a select box which is really simple but it keeps outputting empty options which i don't have these options. why is this?
<form id ="orderby" action="" method="post">
<select name="orderby"style="float:right;">
<option selected="true" style="display:none;">choose view order</option>
<option value="ASC" >Ascending<option>
<option value="DESC">Descending<option>
</select>
<input type="submit" value="Arrange" />
</form>
Upvotes: 0
Views: 36
Reputation: 4987
There's no empty options. Your problem is because of not closing properly second and third option
tags. Try this:
<form id ="orderby" action="" method="post">
<select name="orderby"style="float:right;">
<option selected="true" style="display:none;">choose view order</option>
<option value="ASC" >Ascending</option>
<option value="DESC">Descending</option>
</select>
<input type="submit" value="Arrange" />
</form>
Upvotes: 1
Reputation: 10724
Because your selected option is set to display:none
, either remove that or set one of the other options to selected.
Small detail you should use selected="selected"
instead of true.
Upvotes: 0