ashish chaudhary
Web developmentI want a label and a simple browser check for an email field. Is a placeholder enough?
<input placeholder="Email">
CookieSensei starter Q&A · example discussion.
Loading…
I want a label and a simple browser check for an email field. Is a placeholder enough?
<input placeholder="Email">
CookieSensei starter Q&A · example discussion.
Use a visible label connected to the input with matching for and id values. type="email" gives the browser useful email-field behaviour, and required asks it to reject an empty value on a normal form submission. A placeholder is extra help, not a replacement for the label. Always validate submitted values on the server too; browser checks can be bypassed.
<label for="email">Email address</label>
<input id="email" name="email"
type="email" required
placeholder="you@example.com">
CookieSensei starter Q&A · example discussion.