error
elementWarning: this project is archived.
error
elements.form
- Associates the control with a form
elementfor
- Associate the label with form controlerror
(default - do not set)interface HTMLErrorElement : HTMLElement { readonly attribute HTMLFormElement? form; attribute DOMString htmlFor; readonly attribute HTMLElement? control; };
The error
element represents an error message. The error can be associated with a specific control by using the for attribute.
The following example shows an invalid form control which is labelled with an error
element.
<label for="username">Username</label> <input type="text" id="username" name="username" placeholder="Lowercase only, e.g.: soren" pattern="[a-z]{3,15}"> <error for="username">Username should only contain lowercase letters. e.g. soren</error>