OptionGroup disabled Property - Find out if an option-group is disabled or not: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:OptionGroup

Description

OptionGroup disabled Property - Find out if an option-group is disabled or not:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<select size="6">
  <option value="B">B</option>
  <option value="M">M</option>
  <optgroup id="myOptgroup" label="Swedish Cars">
    <option value="css">CSS</option>
    <option value="html">HTML</option>
    <option value="sql">SQL</option>
  </optgroup>
</select>//from  w w  w  . ja v  a 2s  .  c o  m

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

<script>
function myFunction() {
    var v = document.getElementById("myOptgroup").disabled;
    console.log(v);
}
</script>

</body>
</html>

Related Tutorials