Label htmlFor-eigenschap
Definitie en gebruik
htmlFor
Stel in of geef de waarde van het for-eigenschap van het label (label) terug.
label for-eigenschap Stel vast welke formulierelementen het label bindt.
Zie ook:
HTML Reference Manual:HTML <label> Tag
Voorbeeld
Voorbeeld 1
Geef de waarde van het for-eigenschap van het label terug:
var x = document.getElementById("myLabel").htmlFor;
Voorbeeld 2
Wijzig de waarde van het for-eigenschap van het label:
document.getElementById("myLabel").htmlFor = "newValue";
Syntax
Geef htmlFor-eigenschap terug:
labelObject.htmlFor
Stel htmlFor-eigenschap in:
labelObject.htmlFor = id
Attribute Value
Value | Description |
---|---|
id | The id of the element bound to the label (label). |
Technical Details
Return Value: | A string value representing the id of the element bound to the label (label). |
---|
Browser Support
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | Support | Support | Support | Support |
Related Pages
HTML Reference Manual:HTML <label> for Attribute