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?
Asked
Active
Viewed 4,908 times
11

Isaac King
- 283
- 3
- 13
1 Answers
6
If it does not work, try inserting your place holder text via javascript?
See Insert line break inside placeholder attribute of a textarea?

nickedeye
- 154
- 4
-
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. – Isaac King Dec 24 '17 at 06:43
-
yup. guess it has to be worked around. until the major browsers arrived in the future to support the same standards. – nickedeye Dec 24 '17 at 07:33
tag in an HTML attribute. – Isaac King Dec 24 '17 at 05:26