Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<select size="6">
  <option value="BMW">BMW</option>
  <option value="Mercedes">Mercedes</option>
  <optgroup id="myOptgroup" label="Swedish Cars" disabled>
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="koenigsegg">Koenigsegg</option>
  </optgroup>
</select>
<p>Click the button to find out if a group of options in the drop-down list are disabled.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  var x = document.getElementById("myOptgroup").disabled;
  document.getElementById("demo").innerHTML = x;
}
</script>
</body>
<!-- Mirrored from www.w3schools.com/jsref/tryit.asp?filename=tryjsref_optgroup_disabled by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 05 Sep 2022 15:53:10 GMT -->
</html>