Reputation: 5314
Below are screenshots I took on an empty <select>
in IE8 and Chrome.
What happens is that when a <select>
element is empty, IE8 still shows a long dropdown but with just whitespaces while Chrome shows nothing (which is what I want too in IE).
Any ideas for this?
P.S. I can't add dummy <option>
for this.
Upvotes: 3
Views: 1023
Reputation: 85545
You could do it by inserting a empty option or optgroup like this
<select><optgroup></optgroup></select>
or
<select><option></option></select>
or as @Shivam you could do this as this
<select><option selected="selected">Pick an Option</option>
But you mentioned you don't need dummy option. But the browser behaves you mentioned in your question by default.
Upvotes: 2