Obiekt etykiety HTML DOM
Etykieta obiektu
Obiekt Label reprezentuje element HTML <label>.
Uzyskaj dostęp do obiektu etykiety
Możesz uzyskać dostęp do elementu <label> za pomocą getElementById():
Przykład
var x = document.getElementById("myLabel");
Utwórz obiekt etykiety
Możesz utworzyć element <label> za pomocą metody document.createElement():
Przykład
var x = document.createElement("LABEL");
Właściwości obiektu etykiety
Property | Description |
---|---|
control | Returns the labeled control |
form | Returns a reference to the form that contains the label |
htmlFor | Sets or returns the value of the for attribute of a label |
Standardowe właściwości i zdarzenia
Obiekt Label obsługuje również standardowe właściwości i zdarzenia .
Powiązane strony
Samouczek HTML: formularze HTML
Odniesienie HTML: tag HTML <label>