HTML: Internet Explorer does not allow a disabled option
Sometimes I find it very funny to see what browsers make of some code. Especially when browser developers publish a documentation that proves to be wrong …
Step 1: There is an HTML – reference on MSDN :
Direct link to the option properties
Step 2: Let’s test
You have a HTML select element where the 2nd element should be disabled (works fine in Mozilla / FireFox / Opera):
Here is the code that I use:
<select>
<option>Option1</option>
<option disabled>Option2</option>
<option>Option3</option>
</select>
I thought IE7 would more meet the HTML standards. I know that they don’t follow the W3C specifications correctly but one should assume that Microsoft would meet their own MSDN documentation.
There is no simple way to disable a specific option in a select box. I tried to set the height on 0px, but that fails on every browser.
The CSS property display:none; is very funny. It fails again in Internet Explorer, but works great in other -what some call "exotic"- browsers. But then again … it is still possible to select the 2nd option with your keyboard … funny thing those browsers
No Comments »
RSS feed for comments on this post. TrackBack URL