简体   繁体   English

验证错误:“此时元素输入不允许属性只读。”

[英]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属性只允许用于这些输入类型:

  • text文本
  • search搜索
  • url网址
  • tel电话
  • email电子邮件
  • password密码
  • date日期
  • month
  • week星期
  • time时间
  • datetime-local日期时间本地
  • number数字

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.

相关问题 HTML 5验证失败,因为“此时元素a上不允许属性addthis:url”。 - HTML 5 Validation fails for “Attribute addthis:url not allowed on element a at this point.” W3C验证错误:“目前,元素meta上不允许使用属性名称。” - W3C validation error: “Attribute name not allowed on element meta at this point.” 目前,元素视频上不允许使用属性类型。 如何解决这个错误? - Attribute type not allowed on element video at this point. how to fix this error? 验证错误:此时元素输入上不允许使用 onfocusout 属性 - Validation error: Attribute onfocusout not allowed on element input at this point 我不明白这个错误“此时元素 iframe 上不允许使用属性 iframe”。 w3c - I don't understand this error "Attribute iframe not allowed on element iframe at this point." w3c 此时不允许对元素输入进行属性捕获 - Attribute capture not allowed on element input at this point W3C验证:此时元素a上不允许属性alt - W3C Validation: Attribute alt not allowed on element a at this point 您好,我收到关于 img 的 HTML 代码错误 — 此时元素输入上不允许使用属性 img - Hello, I'm receiving an HTML code error regarding img — Attribute img not allowed on element input at this point 错误:目前,元素li上不允许使用属性audio_url - Error: Attribute audio_url not allowed on element li at this point 此时元素img上不允许使用属性img。 - Attribute img not allowed on element img at this point.Error
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM