在HTML属性中包含换行符

时间:2022-11-30 02:02:10

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?

我有一个带有“占位符”属性的HTML textarea,其中包含换行符的代码, 。它在Chrome上运行正常,但在其他浏览器上会忽略换行符。造成这种不一致的原因是什么,我该如何解决?

1 个解决方案

#1


1  

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?

如果它不起作用,请尝试通过javascript插入占位符文本?请参阅在textarea的占位符属性中插入换行符?

#1


1  

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?

如果它不起作用,请尝试通过javascript插入占位符文本?请参阅在textarea的占位符属性中插入换行符?