[thelist] Disabling & re-enabling options
Fernando Gómez
fgomez at criba.edu.ar
Fri Sep 27 14:00:01 CDT 2002
Hello,
I'm working with menus (SELECT elements), some of whose initial options may
have to be disabled (and maybe re-enabled) later. One way to disable an
option is by simply "killing" it:
selectElement.options[i] = null;
But if I want to re-enable this option later, then it's not as easy as
appending it as a new option: the exact position in the options array is
important for me.
I thought it would be easier if I could play with some CSS property of the
OPTION element, say "visibility: hidden", or "display: none", so you don't
have to remove or append OPTION elements. But that doesn't work on IE 5.x.
On the other hand, I've found in W3C's HTML spec that:
"The following elements support the *disabled* attribute: BUTTON, INPUT,
OPTGROUP, OPTION, SELECT, and TEXTAREA."
But it doesn't work that way, at least on this IE 5.5 :-(
So, do I necessarily have to remove/append options if I want to temporarily
disable/enable some of them, if IE 5.x is important for me?
Thanks for your ideas :)
Fernando Gomez
More information about the thelist
mailing list