![](/img/trans.png)
[英]How to edit HTML document with tags in textarea without displaying the tags?
[英]HTML Tags Not Displaying Properly Inside Textarea
我的文字区域字段有问题。 当我从数据库中的textarea字段中选择值时,浏览器无法理解HTML标记(例如: </br>
)。
这是我的领域:
<textarea id="id_get_post_description2" maxlength="9999" name="description_post" style="resize:none; font-size: 12pt; width:100%; height:90%; border:1px solid #0099FF;" type="text"></textarea>
您必须使用转义字符:有关更多信息,请查看此字符: http : //www.w3.org/International/questions/qa-escapes#answer
您需要转义html保留字符: http : //www.theukwebdesigncompany.com/articles/entity-escape-characters.php
因此,您应使用<
代替<
, 。 应该用您的数据库或生成HTML时替换它。
谢谢您的帮助! 你给我替换的想法,我用一个字符串固定了它:)
description_post = description_post.replace(/<br>/g, "\n");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.