Given the HTML document
<!DOCTYPE html>
<html>
<head>
<title>Title</title>
</head>
<body>
<form>
<input type="email" placeholder="E-Mail"/>
</form>
</body>
</html>
the W3C validator (v1.3) gives the following error message:
Line 8, Column 48: Attribute
placeholder
is only allowed when the input type is e-mail, number, password, search, tel, text, or url.
Why?
This seems to be a bug in the validator.
Both validators, http://validator.w3.org/ and http://validator.w3.org/nu/, report that the placeholder
attribute is "only allowed when the input type is e-mail
[…]".
However, the HTML5 input type is called email
, not e-mail
(which both validators correctly recognize if type="e-mail"
is used instead).
Without looking at the code, I guess that when placeholder
is used, they check for e-mail
instead of email
. It works as expected with all other allowed input types.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With