English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Die form-Attribut gibt an, zu welchem oder welchen Formulartypen das <label>-Element gehört.
Ein <label>-Element, das sich außerhalb des Formulars befindet (aber dennoch Teil desselben ist):
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Verwendung des HTML-Attributs <label> for-Grundlegende Anleitung(oldtoolbag.com)</title> </head> <body> <p>Die Beschriftung des ersten Radio-Buttons befindet sich außerhalb des Formulars, ist aber dennoch Teil desselben. Versuchen Sie, auf den Textbeschriftung zu klicken, um den männlichen Radio-Button umzuschalten.</p> <form action="action_page.php" id="form1"> <input type="radio" name="gender" id="male" value="male"><br> <label for="female">Female</label> <input type="radio" name="gender" id="female" value="female"><br> <label for="other">Other</label> <input type="radio" name="gender" id="other" value="other"><br><br> <input type="submit" value="Submit"> </form> <label for="male" form="form1">Male</label> </body> </html>Test See ‹/›
IEFirefoxOperaChromeSafari
All major browsers support the form attribute.
The form attribute specifies one or more forms to which the <label> element belongs.
form attribute in HTML5 New Attribute in
<label form="form_id">
Value | Description |
---|---|
form_id | Specifies the form element to which the <label> element belongs. The value of this attribute must be the id attribute of a <form> element in the same document. |