web api instance property
HTMLOptGroupElement: label property
The label property of the HTMLOptGroupElement interface is a string value that reflects the <optgroup> element’s label attribute, which provides a textual label to the group of options.
Value
A string.
Examples
const optionGroup = document.getElementById("groupB");
console.log(optionGroup.label);
optionGroup.label = `${optionGroup.label} (${optionGroup.children.length})`;
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
<optgroup>- HTML
labelattribute