OptionGroup label attribute
Definition and usage
label
Set or return the value of the label attribute of the option group.
HTML <optgroup> label Attribute Specifies the label/description of the option group.
See also:
HTML Reference Manual:HTML <optgroup> Tag
Example
Example 1
Change the label/description of the option group:
document.getElementById("myOptgroup").label = "华系车";
Example 2
Return the label/description of the option group:
var x = document.getElementById("myOptgroup").label;
Syntax
Return the label attribute:
optiongroupObject.label
Set the label attribute:
optiongroupObject.label = text
Attribute Value
Value | Description |
---|---|
text | Specifies the label/description of the option group. |
Technical Details
Return Value: | A string value representing the label of the option group. |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <optgroup> label Attribute