You are here: Reference > JavaScript > client-side > style handling > properties > disabled (styleSheet)

disabled property (styleSheet)

Browser support:
Sets or retrieves a Boolean value that indicates the interaction privileges of the current styleSheet object.

Syntax:

object.disabled;
You can find the related objects in the Supported by objects section below.
This property is read/write.

Possible values:

Boolean that indicates whether the user can interact with the object.
One of the following values:
false
Interaction is enabled.
true
Interaction is disabled.
Default: this property has no default value.

Example HTML code 1:

This example shows how to change the disabled state of the styleSheet object:
<head>
    <style>
        .red {
            color: red;
        }
    </style>
    <script type="text/javascript">
        function DisableRed () {
            document.styleSheets[0].disabled = true;
        }

        function EnableRed () {
            document.styleSheets[0].disabled = false;
        }
    </script>
</head>
<body>
    <button onclick="DisableRed ();">Disable '.red' styleSheet</button>
    <button onclick="EnableRed ();">Enable '.red' styleSheet</button>
    <br /><br />
    <div class="red">red division</div>
    <div>non-red division</div>
    <span class="red">red span</span>
</body>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content