how to show <html> in textarea

后端 未结 2 1279
闹比i
闹比i 2020-12-21 18:26

In textarea, I load text from database and then show in textarea. I have a problem, textarea not show < and >. It has been changed to

相关标签:
2条回答
  • 2020-12-21 18:49

    You may also want to use the Entity Number. It depends on the page character set. For ISO-8859-1 you would do "&#60(semicolon)" and "&#62(semicolon)". replace the "(semicolon)" part with ; ... This just shows that this page supports it too :)

    For a complete list view HTML ISO-8859-1 Reference

    0 讨论(0)
  • 2020-12-21 18:57

    Escape the & by using &amp;.

    Change this:

    <textarea>&lt;html&gt;</textarea>
    

    To this:

    <textarea>&amp;lt;html&amp;gt;</textarea>
    

    If you're using PHP you can automatically do this with htmlspecialchars().

    0 讨论(0)
提交回复
热议问题