Fieldset disabled Property

Fieldset Object Reference Fieldset Object

Example

Disable a fieldset:

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

The result will be:

Personalia: Name:
Email:
Date of birth:
Try it yourself »

Definition and Usage

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

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

A disabled element is unusable and un-clickable. Disabled elements are usually rendered in gray by default in browsers.

This property reflects the HTML disabled attribute.


Browser Support

Internet Explorer Firefox Opera Google Chrome Safari

The disabled property is supported in all major browsers, except Internet Explorer and Safari.

Note: Internet Explorer supports the disabled property on return. However, on set, it will make the form elements gray, but they will still be usable (not disabled).


Syntax

Return the disabled property:

fieldsetObject.disabled

Set the disabled property:

fieldsetObject.disabled=true|false

Property Values

Value Description
true|false Specifies whether a group of related form elements (a fieldset) should be disabled or not
  • true - The fieldset is disabled
  • false - Default. The fieldset is not disabled

Technical Details

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

More Examples

Example

Find out if a fieldset is disabled or not:

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

The result of x will be:

true
Try it yourself »

Example

Disable and undisable a fieldset:

function disableField() {
    document.getElementById("myFieldset").disabled = true;
}

function undisableFieldset() {
    document.getElementById("myFieldset").disabled = false;
}
Try it yourself »

Related Pages

HTML reference: HTML <fieldset> disabled attribute


Fieldset Object Reference Fieldset Object