向通过 .text() 填充的文本区域添加换行符

发布于 2024-12-14 08:14:27 字数 312 浏览 5 评论 0原文

我有一个向表添加行的方法。其中一个单元格是一个textarea;我添加了一个脚本来添加换行符。但是,当添加它时,它实际上会写入
文本。

我认为这是因为我使用 .text() 调用值。

我尝试使用 replaceWith() 替换写入的
,但这也不起作用。

这是小提琴

I have a from that adds rows to a table. One of the cells is a textarea; I have added a script to add line breaks to this. However when it is added it actually writes the <br> text.

I think this is because I am calling the values using .text().

I tried to replace the written <br> using replaceWith() but that didn't work either.

Here is the fiddle.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔落墨 2024-12-21 08:14:27

尝试使用 .html() 而不是 .text()。

Try using .html() instead of .text().

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文