HTML placeholder attribute is not a valid attribute

SPBeginer picture SPBeginer · Jan 13, 2013 · Viewed 10.4k times · Source

On SharePoint application page I am using placeholder in <input> like this:

<input type="text" id="name" name="name" placeholder="your name" />

But placeholder is underlined and says: Validation (XHTML 1.0 transitional) Attribute placeholder is not a valid attribute. But when i put runat = "server", error goes away

<input type="text" id="name" name="name" placeholder="your name" runat="server" /> 

Now, its valid attribute. I could not understand why placeholder attribute is not valid without runat = "server". Can anybody tell the reason? I did not want to use runat = "server".

I have also added <!DOCTYPE html>at top of the application page, but still it gives same error

Answer

Muhammad Talha Akbar picture Muhammad Talha Akbar · Jan 13, 2013

You are using HTML5 markup, with XHTML 1.0 Transitional doctype

placeholder, article, footer, etc are all HTML5

<!DOCTYPE html>

Above is the appropriate DOCTYPE for HTML5.