繁体   English   中英

无法在textarea内容中呈现HTML标记

[英]Not able to render HTML tags inside textarea content

我有一个带有textarea输入元素的HTML文件,内容是从包含<br/>标签的数据库中提取的。

我的JSON响应是:
NDAs can be "mutual", meaning both parties are restricted in their use of the materials provided, or they can restrict the use of material by a single party. <br /> It is also possible for an employee to sign an NDA or NDA-like agreement with an employer.

渲染是不采取新行,并显示<br/> ,因为它是(以静态内容)。 我使用了{{{content}}}把手,但没有帮助。

您根本无法在textarea中输入HTML,您只能插入纯文本。

您可能想要使用可编辑的div( <div contenteditable="true">...</div>

参考。 https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable

如果您希望呈现HTML,则应使用contenteditable来执行此操作。

您可以尝试用/n替换<br /> 这应该可以解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM