Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Fieldset disabled property

Fieldset disabled property

Fieldset Object Reference Fieldset Object

Example

Disable the fieldset:

document.getElementById("myFieldset").disabled=true;

Output result:

Try it »


Definition and Usage

The disabled property sets or returns whether a group of related form elements (a fieldset) is disabled.

If this property is set, the form elements within the fieldset are disabled.

Disabled elements are unavailable and cannot be clicked. By default, disabled elements are usually rendered in gray in the browser.

This attribute reflects the HTML disabled attribute.


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

Except for Internet Explorer and Safari, all other major browsers support the disabled property.


Syntax

Return the disabled attribute:

fieldsetObject

.disabled

Set the disabled attribute:

fieldsetObject

.disabled=true|false

Attribute values

Value Description
true|false Specifies whether a group of related form elements (a fieldset) is disabled.
  • true - disables the fieldset.
  • false - default. Does not disable the fieldset.
  • |

    Technical Details

    Return Value: Boolean, returns true if the fieldset is disabled, otherwise returns false.

    More examples

    Example

    Check whether a fieldset is disabled:

    var x = document.getElementById("myFieldset").disabled;

    x The output is:

    true

    Try it »

    Example

    Disable and re-enable the fieldset:

    function disableField()

      {

      document.getElementById("myFieldset").disabled=true;

      }

    function undisableFieldset()

      {

      document.getElementById("myFieldset").disabled=false;

      }

    Try it »


    Related Articles

    HTML Reference Manual:HTML

    disabled attribute


    Fieldset Object Reference Fieldset Object