OptionGroup label Property
Example
Change the label/description of the option group:
document.getElementById("myOptgroup").label="A Random Car Selection";
Try it »
Definition and Usage
The label property sets or returns the value of the label attribute of the option group.
The label attribute specifies the label/description of the option group.
Browser support





All major browsers support the label property.
Syntax
Return the label property:
optiongroupObject
.label
Set the label property:
optiongroupObject
.label=
text
Attribute values
| Value | Description |
|---|---|
| text | Specifies the label/description of the option group. |
Technical Details
| Return Value: | A string representing the label of the option group. |
|---|
More examples
Example
Return the label/description of the option group:
var x = document.getElementById("myOptgroup").label;
document.getElementById("demo").innerHTML=x;
x The output is:
Swedish Cars
Try it »
Related Articles
HTML Reference Manual:HTML
OptionGroup Object