![](/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.