html textarea如何插入 键入文本到行尾的标记

问题描述 投票:0回答:1

当用户在textarea框中输入文本并且不使用enter并将其包装到下一行时,我想添加一个<br>标记。

Example)

Image where the user entered text in the textarea box

If the current textarea value is displayed on the screen

这就是现实的生活吗?这只是幻想吗?陷入山体滑坡,无法摆脱现实。

What I want

这就是现实的生活吗?这只是幻想吗? 陷入山体滑坡,无法逃脱 现实。

我想解决这个问题。

请帮我。

javascript jquery html html5
1个回答
0
投票

试试这个:

<textarea cols='60' rows='8'>This is my statement one.&#13;&#10;This is my statement2</textarea>
© www.soinside.com 2019 - 2024. All rights reserved.