HTML5 textarea placeholder not appearing
its because there is a space somewhere. I was using jsfiddle and there was a space after the tag. After I deleted the space it started working
This one has always been a gotcha for me and many others. In short, the opening and closing tags for the <textarea>
element must be on the same line, otherwise a newline character occupies it. The placeholder will therefore not be displayed since the input area contains content (a newline character is, technically, valid content).
Good:
<textarea></textarea>
Bad:
<textarea>
</textarea>
Update (2020)
This is not true anymore, according to the HTML5 parsing spec:
If the next token is a U+000A LINE FEED (LF) character token,
then ignore that token and move on to the next one. (Newlines
at the start of textarea elements are ignored as an authoring
convenience.)
You might still have trouble if you editor insists on ending lines with CRLF, though.
Delete all spaces and line breaks between <textarea>
opening and closing </textarea>
tags.
<textarea placeholder="YOUR TEXT"></textarea> ///Correct one
<textarea placeholder="YOUR TEXT"> </textarea> ///Bad one It's treats as a value so browser won't display the Placeholder value
<textarea placeholder="YOUR TEXT">
</textarea> ///Bad one