OptionGroup label attribute

Definition and usage

label Set or return the value of the label attribute of the option group.

HTML <optgroup> Label-Eigenschaft Definiert das Label/ die Beschreibung der Optiongruppe.

See also:

HTML-Referenzhandbuch:HTML <optgroup> Tag

Instance

Example 1

Change the label/description of the option group:

document.getElementById("myOptgroup").label = "华系车";

Try it yourself

Example 2

Return the label/description of the option group:

var x = document.getElementById("myOptgroup").label;

Try it yourself

Syntax

Return the label attribute:

optiongroupObject.label

Set the label attribute:

optiongroupObject.label = text

Attributwert

Wert Beschreibung
text Definiert das Label/ die Beschreibung der Optiongruppe.

Technische Details

Rückgabewert: Zeichenkettenwert, der das Label der Optiongruppe darstellt.

Browser-Unterstützung

Chrome Edge Firefox Safari Opera
Chrome Edge Firefox Safari Opera
Unterstützung Unterstützung Unterstützung Unterstützung Unterstützung

Verwandte Seiten

HTML-Referenzhandbuch:HTML <optgroup> Label-Eigenschaft