Fieldset disabled attribute

Definition and usage

disabled Sets or returns whether a group of related form elements (fieldset) is disabled.

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

Disabled elements are not available and cannot be clicked. By default, disabled elements are usually displayed in gray in browsers.

This attribute reflects <fieldset> disabled attribute.

See also:

HTML Reference Manual:HTML <fieldset> Tag

Example

Example 1

Disable fieldset:

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

Try it yourself

Example 2

Check if the fieldset is disabled:

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

Try it yourself

Example 3

Disable and enable fieldset:

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

Try it yourself

Syntax

Return the disabled attribute:

fieldsetObject.disabled

Set the disabled attribute:

fieldsetObject.disabled = true|false

Attribute value

Value Description
true|false

Specifies whether a group of related form elements (fieldset) should be disabled.

  • true - The fieldset is disabled
  • false - Default. The fieldset is not disabled

Technical details

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

Browser Support

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Supported 12.0 * Supported 6.1 Supported

* Internet Explorer 11 and earlier versions support the disabled attribute when returning. However, when setting, the element is displayed as disabled, but users can still interact with it.

Related Pages

HTML Reference Manual:HTML <fieldset> disabled Attribute