[thelist] Disabling & re-enabling options

Fernando Gómez fgomez at criba.edu.ar
Fri Sep 27 14:49:01 CDT 2002


From: "Chris Blessing" <webguy at mail.rit.edu>
Sent: Friday, September 27, 2002 4:41 PM

> You want to remove the option from the list?  If so, use this:
>
> <script language="JavaScript1.1">
> function deleteOption(selectBox, optionIndex){
> // pass in document.form.select and the index of the
> // option to delete
>
> selectBox.options[optionIndex] = null;
> }
> </script>

Hi Chris,

Thank you, but I'm afraid this is not what I was looking for...

In my original message, I mentioned that this approach was what I tried
first. Then I realized that it was not very practical if later you want to
_re-enable_ that same option, in the exact position it occupied in the
options list. (It's not that it is very difficult, just that I would prefer
to avoid it.)

So I began to think about the 'disabled' attribute for the option element,
or a CSS property to hide the option (if that were possible). The problem is
that IE 5.x doesn't do anything when I write code like this:

<select>
<option disabled>first</option>
<option>second</option>
</select>

So, is there any hope to _disable_ an option, or is it necessary to _remove_
it?


Fernando






More information about the thelist mailing list