Option disabledProperty

Option 对象参考手册Option Object

Example

Example 1

Disable the second option in the dropdown list:

<script>

document.getElementById("mydrop").options[1].disabled=true;

</script>

Output result:

Cat Dog Horse

Try it Yourself »


Definition and Usage

The disabled property sets or returns whether an <option> element is disabled by default.

The disabled input element is neither usable nor clickable. The disabled attribute can be set until some other condition is met (such as selecting a checkbox, etc.).

Syntax

Set the disabled property:

element.disabled=true|false

Return the disabled property:

element.disabled


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the disabled property


Option 对象参考手册Option Object Other Extensions