11

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?

Isaac King
  • 283
  • 3
  • 13

1 Answers1

6

Include the line break naturally with the keyboard enter? Like it is shown in this image, click to see it.

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