Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to show <html> in textarea

Tags:

html

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 ?

like image 807
saturngod Avatar asked Jan 01 '26 09:01

saturngod


1 Answers

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

like image 62
Delan Azabani Avatar answered Jan 03 '26 23:01

Delan Azabani



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!