문제

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

도움이 되었습니까?

해결책

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.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top