HTMLOptGroupElement: label-Eigenschaft
Baseline
Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since Juli 2015.
Die label-Eigenschaft des HTMLOptGroupElement-Interfaces ist ein String-Wert, der das label-Attribut des <optgroup>-Elements widerspiegelt. Dieses Attribut bietet eine textuelle Bezeichnung für die Gruppe von Optionen.
Wert
Ein String.
Beispiele
js
const optionGroup = document.getElementById("groupB");
console.log(optionGroup.label);
optionGroup.label = `${optionGroup.label} (${optionGroup.children.length})`;
Spezifikationen
| Specification |
|---|
| HTML> # dom-optgroup-label> |
Browser-Kompatibilität
Loading…
Siehe auch
<optgroup>- HTML-
label-Attributlabel