Fieldset disabledProperty

Fieldset 对象参考手册Fieldset Object

Examples

Disable the fieldset:

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

Output:

Personalia:Username:
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.

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

Disabled elements are unusable and un-clickable. By default, disabled elements are usually rendered in gray in browsers.

This property reflects the HTML disabled attribute.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All mainstream browsers support the disabled attribute, except Internet Explorer and Safari.


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) is disabled.
  • true - Disables the fieldset.
  • false - Default. Does not disable the fieldset.

Technical Details

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


More Examples

Example

Check if a fieldset is disabled:

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

xOutput:

true

Try it Yourself »

Example

Disable and un-disable a fieldset:

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

Try it Yourself »


Related Articles

HTML Reference:HTML <fieldset> disabled Attribute


Fieldset 对象参考手册Fieldset Object

Other Extensions