Pregunta

I have the following errors on my page, when validated with http://validator.w3.org/ there is no attribute "placeholder" there is no attribute "autocomplete"

in details it says:

Line 59, Column 81: there is no attribute "placeholder" …rd" type="text" style="width:500px;" placeholder=" What" autocomplete="off" /> ✉ 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 (e.g. 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).

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. If you received this error when using the element to incorporate flash media in a Web page, see the FAQ item on valid flash.

the html tag is here: <input name="keyword" id="keyword" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />

¿Fue útil?

Solución

If you are using html5 then you should use normal doctype.

<!DOCTYPE HTML>
<html>
<head>
<TITLE>My first HTML document</TITLE>
</head>
<body>
  <input name="keyword" id="keyword" type="text" style="width:500px;" placeholder=" What" autocomplete="off" />
</body>
</html>

if you are using html4 or anything else then you can use following one of this

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

For more info..

http://www.w3.org/TR/html-markup/syntax.html#normal-doctype

Otros consejos

make sure your using the html5 doctype <!DOCTYPE html> And that the validator is validating HTML5

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top