Select disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Select


The disabled property sets or gets whether a drop-down list should be disabled.

This property reflects the HTML disabled attribute.

Set the disabled property with the following Values

Value Description
true|false Sets whether a drop-down list should be disabled

Return Value

A Boolean, returns true if the drop-down list is disabled, otherwise it returns false

The following code shows how to disable a drop-down list:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<select id="mySelect">
</select>//from  w w  w . ja v a  2 s .  c  o  m

<button onclick="myFunction()">Test</button>

function myFunction() {
    document.getElementById("mySelect").disabled = true;


Related Tutorials