I have an HTML textarea with a "placeholder" attribute that includes the code for a line break, &\#10;. It works fine on Chrome, but the line break is ignored on other browsers. What is causing this inconsistency, and how do I work around it?
1 Answer
If it does not work, try inserting your place holder text via javascript?
See Insert line break inside placeholder attribute of a textarea?
2 Comments
Isaac King
A literal line break only seems to work in the same browsers as
&\#10;- In Firefox and Safari, it's just ignored. The other answer you linked to mentioned that the spec forbids line break characters in the placeholder text, so I guess it's Chrome that's non-compliant. That's quite frustrating. That other thread included some workarounds through, so I can use one of those.nickedeye
yup. guess it has to be worked around. until the major browsers arrived in the future to support the same standards.
\nas new line in your placeholder. it's definite to work across browsers.