[英]Validation error: “Attribute readonly not allowed on element input at this point.”
When I try to validate the following HTML:当我尝试验证以下 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?由于这是一个文本输入,为什么我会收到验证错误?
This is bug in the W3C Markup Validator;这是 W3C 标记验证器中的错误; 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.在等待修复错误(我预计很快会发生)时,请改用validator.nu服务。
Update: The bug has now been fixed.更新:该错误现已修复。
readonly
attribute is only allowed on these input types: readonly
属性只允许用于这些输入类型:
For any other input type like hidden
, you are not allowed to have readonly
in which case you may get:对于任何其他输入类型,如hidden
,您不允许具有readonly
在这种情况下您可能会得到:
Error: Attribute readonly not allowed on element input at this point.错误:此时元素输入不允许属性只读。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.