[Javascript] disabled menus

Paul Novitski paul at novitskisoftware.com
Tue Mar 1 00:35:08 CST 2005

At 07:19 PM 2/28/2005, Chuck Soper wrote:
>I'm trying to display disabled menu items.


To disable a select option, just add the "disabled" attribute to the tag:

HTML:  <option disabled>Banana</option>
XHTML: <option disabled="disabled">Banana</option>

The disabled option is greyed out and can't be selected.

You can set this attribute with Javascript using code like this:

         oOption.setAttribute("disabled", "disabled");

where oOption is the OPTION object.

The disabled option is listed as an attribute of OPTION in the W3C HTML 

         The SELECT, OPTGROUP, and OPTION elements

(scroll down to the OPTION section)


More information about the Javascript mailing list