Javascript DOM HTML Fieldset disabled Property get

Introduction

Find out if a fieldset is disabled or not:

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

Click the button below to find out if the fieldset above is disabled.

View in separate window

<!DOCTYPE html>
<html>
<body>

<form>
  <fieldset id="myFieldset" disabled>
  <legend>MyNameFieldset:</legend>
  Name: <input type="text"><br>
  Email: <input type="text"><br>
  Date of birth: <input type="text">
  </fieldset>
</form>//from  ww w. j  a va 2  s  .c  o  m
<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
  var x = document.getElementById("myFieldset").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>



PreviousNext

Related