Latest web development tutorials
 

Fieldset disabled Property

< 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

Property
disabled Yes 12.0* Yes 6.1 Yes

* Internet Explorer 11 and below, supports the disabled property on return. However, on set, the element appear disabled but the user can still interact with it.


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