OptionGroup label attribute
Definition and usage
label
Set or return the value of the label attribute of the option group.
HTML <optgroup> label 属性 规定选项组的标签/描述。
See also:
HTML 参考手册:HTML <optgroup> 标签
Instance
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 label attribute:
optiongroupObject.label
Set label attribute:
optiongroupObject.label = text
属性值
值 | 描述 |
---|---|
text | 规定选项组的标签/描述。 |
技术细节
返回值: | 字符串值,表示选项组的标签。 |
---|
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
支持 | 支持 | 支持 | 支持 | 支持 |
相关页面
HTML 参考手册:HTML <optgroup> label 属性