Question

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

Était-ce utile?

La solution

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.

Autres conseils

placeholder is a HTML5 attribute, Therefore it shouldn't be valid under xHTML 1.0 Transitional. As for the runat attribute changing the behavior, it's most likely a flaw in the system or just being suppressed for some reason.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top