Fieldset disabled Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Fieldset


The disabled property sets or gets whether a form fieldset is disabled.

This property reflects the HTML disabled attribute.

Set the disabled property with the following Values

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

Return Value

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

The following code shows how to disable a fieldset:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

  <fieldset id="myFieldset">
    Name: <input type="text"><br>
    Email: <input type="text"><br>
    Date of birth: <input type="text">
</form>/*  w w  w .  j  a  va2 s  .com*/

<button onclick="myFunction()">Test</button>

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

Related Tutorials