THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM OptionGroup Object


OptionGroup Object

The OptionGroup object represents an HTML <optgroup> element.

Access an OptionGroup Object

You can access an <optgroup> element by using getElementById():

var x = document.getElementById("myOptgroup");

Create an OptionGroup Object

You can create an <optgroup> element by using the document.createElement() method:

var x = document.createElement("OPTGROUP");

OptionGroup Object Properties

Property Description
disabled Sets or returns whether an option-group is disabled, or not
label Sets or returns the value the label attribute of an option-group