Reputation: 28424
When I try to validate the following HTML:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>test page</title>
</head>
<body>
<input type="text" name="testInput" value="test value" readonly="readonly" style="background-color: #e3e3e3;">
</body>
</html>
The validator gives the error:
Line 8, Column 118: Attribute readonly not allowed on element input at this point.
But in the error details it says:
readonly when type is text, ...
As this is a text input, why am I receiving the validation error?
Upvotes: 2
Views: 3484
Reputation: 17964
readonly
attribute is only allowed on these input types:
For any other input type like hidden
, you are not allowed to have readonly
in which case you may get:
Error: Attribute readonly not allowed on element input at this point.
Upvotes: 0
Reputation: 201768
This is bug in the W3C Markup Validator; I have submitted a bug report.
While waiting for the bug to be fixed (which I expect to happen soon), use the validator.nu service instead.
Update: The bug has now been fixed.
Upvotes: 3