This content originally appeared on DEV Community and was authored by Carlos Espada
What do the specifications say about the placeholder?
The
placeholder
attribute represents a short hint (a word or short phrase) intended to aid the user with data entry when the control has no value. A hint could be a sample value or a brief description of the expected format.
For example:
<label for="email-address">Email</label>
<input
type="email"
id="email-address"
name="email-address"
placeholder="john.doe@example.com"
/>
The function of the placeholder
attribute is very different from that of <label>
: a label is a title of the form control and it must always be present, the placeholder is just a help hint in certain fields and it may or may not exist. Different elements to fulfill different functions.
So when you are doing the HTML of the forms, remember that: there is no case where placeholder can replace label.
This content originally appeared on DEV Community and was authored by Carlos Espada
Carlos Espada | Sciencx (2021-12-22T07:22:39+00:00) A11y tips: placeholder can’t replace label. Retrieved from https://www.scien.cx/2021/12/22/a11y-tips-placeholder-cant-replace-label/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.