![](/img/trans.png)
[英]HTML 5 Validation fails for “Attribute addthis:url not allowed on element a at this point.”
[英]Validation error: “Attribute readonly not allowed on element input at this point.”
當我嘗試驗證以下 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>
驗證器給出錯誤:
Line 8, Column 118: Attribute readonly not allowed on element input at this point.
但是在錯誤詳細信息中它說:
readonly when type is text, ...
由於這是一個文本輸入,為什么我會收到驗證錯誤?
readonly
屬性只允許用於這些輸入類型:
對於任何其他輸入類型,如hidden
,您不允許具有readonly
在這種情況下您可能會得到:
錯誤:此時元素輸入不允許屬性只讀。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.