how to show <html> in textarea

html

5266 просмотра

2 ответа

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

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

in textarea , change to . I want to show &lt;html&gt; , how to make it ?

Автор: saturngod Источник Размещён: 12.11.2019 09:25

Ответы (2)


9 плюса

Решение

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().

Автор: Delan Azabani Размещён: 09.06.2010 05:56

0 плюса

You may also want to use the Entity Number. It depends on the page character set. For ISO-8859-1 you would do "<(semicolon)" and ">(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

Автор: Mukus Размещён: 30.09.2012 06:19
Вопросы из категории :
32x32