简体   繁体   English

W3C验证错误:没有属性“占位符”

[英]W3C validation error: there is no attribute “placeholder”

I am getting the following error from W3C validation: 我从W3C验证中收到以下错误:

Line 326, Column 63: there is no attribute placeholder 第326行,第63列:没有属性placeholder

 … type="text" name="pc" id="postcodefield" placeholder="Vul hier uw Postcode" /> 

You have used the attribute named above in your document, but the document type you are using does not support that attribute for this element. 您已经在文档中使用了上面命名的属性,但是您正在使用的文档类型不支持该元素的该属性。 This error is often caused by incorrect use of the "Strict" document type with a document that uses frames (eg you must use the "Transitional" document type to get the "target" attribute), or by using vendor proprietary extensions such as "marginheight" (this is usually fixed by using CSS to achieve the desired effect instead). 此错误通常是由于使用框架的文档未正确使用“严格”文档类型(例如,必须使用“过渡”文档类型来获取“目标”属性)或使用供应商专有扩展名(例如“ marginheight”(通常通过使用CSS来实现所需的效果来解决此问题)。

This error may also result if the element itself is not supported in the document type you are using, as an undefined element will have no supported attributes; 如果所使用的文档类型不支持该元素本身,也可能导致此错误,因为未定义的元素将不具有支持的属性; in this case, see the element-undefined error message for further information. 在这种情况下,请参阅元素未定义的错误消息以获取更多信息。

How to fix: check the spelling and case of the element and attribute, (Remember XHTML is all lower-case) and/or check that they are both allowed in the chosen document type, and/or use CSS instead of this attribute. 解决方法:检查元素和属性的拼写和大小写(记住XHTML均为小写)和/或检查所选文档类型是否都允许它们,和/或使用CSS代替此属性。 If you received this error when using the element to incorporate flash media in a Web page, see the FAQ item on valid flash. 如果在使用元素将Flash Media合并到网页中时收到此错误,请参阅有效Flash上​​的FAQ项。

Please see the source code: 请查看源代码:

<form method="get" action="">
    <input type="text" name="pc" id="postcodefield" placeholder="Vul hier uw Postcode" />
    <input type="submit" class="search_button" value="Zoeken" id="searchbutton" />
</form>

Please help me to solve this. 请帮我解决这个问题。

I believe that's because of your DOCTYPE . 我相信那是因为您的DOCTYPE You're currently using HTML5 markup so you need: 您当前正在使用HTML5标记,因此您需要:

<!DOCTYPE html>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM