Is there a functional dropdown replacement for HTML SELECT that works in IE?
We determined in a previous question that many HTML SELECT features are not supported in IE. Is there an alternative widget that you would recommend in your experience that meets the following requirements?
- Refers to a property
contentEditable
(does not allow selection changes if true) - Respects the property
disabled
for individual OPTIONS (shows that they are "grayed out" or through font and makes them unavailable) - Support for groups of options (
OPTGROUP
elements) - Supports
style
parameters likeborder
andmargin
inSELECT
and all subitems - Supports dynamic addition and removal of items
OPTION
andOPTGROUP
- Supports the above in IE 6 and above
EDIT: As @Joel Coehoorn pointed out, items 3 and 5 above are currently supported in IE. They are included here to make sure they are not overlooked in the replacement widget.
source to share
Finally, IE6 + supports # 3 and # 5, and you can (incorrectly) use OPTGROUP to work with most other elements.
You can do this if it has an opt group with missing parameters, for example:
<optgroup label="--"></optgroup>
You can make the label anything you want, but the point is that you end up with an item that looks like a normal option but cannot be selected. This opens the door to all kinds of entertainment:
- You can disable certain items by adding them as opt groups
- You can prevent selection changes by encoding all options except the current one as opt groups (use a different text key to indicate they are disabled if you need to)
- You can use space, -, or - labels to denote simple separators rather than entire groups.
In this case, most of the accounts # 1 and # 2 are on your list - at least at feature points.
The reason for the "(mis) use" is that most html validators will fail. However, the trick works in all major browsers.
source to share