Fieldset disabled Property - Find out if a fieldset is disabled or not: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Fieldset

Description

Fieldset disabled Property - Find out if a fieldset is disabled or not:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<form>
  <fieldset id="myFieldset">
    <legend>Personalia:</legend>
    Name: <input type="text"><br>
    Email: <input type="text"><br>
    Date of birth: <input type="text">
  </fieldset>
</form><br>

<button onclick="disableField()">Disable fieldset</button>
<button onclick="enableField()">Enable fieldset</button>

<script>
function disableField() {//from w w  w . jav  a 2  s. c  o  m
    document.getElementById("myFieldset").disabled = true;
    var v = document.getElementById("myFieldset").disabled;
    console.log(v);
}

function enableField() {
    document.getElementById("myFieldset").disabled = false;
    var v = document.getElementById("myFieldset").disabled;
    console.log(v);

}
</script>
</body>
</html>

Related Tutorials