Can't display HTML tags inside textarea content.

I have an HTML file with a textarea input element and the content is being fetched from a database that includes tags <br/>

.

My JSON response:
NDAs can be "mutual", meaning both parties are restricted in their use of the materials provided, or they can restrict the use of material by a single party. <br /> It is also possible for an employee to sign an NDA or NDA-like agreement with an employer.

When rendering, it does not take a newline and does not render <br/>

as is (takes as static content). I used pens {{{content}}}

but didn't help.

+3


source to share


3 answers


You just cannot enter HTML inside a textbox, you can only insert pure text.

You can use editable div ( <div contenteditable="true">...</div>

)



Ref. https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_Editable

+2


source


If you want your HTML to be rendered, you must use contenteditable .



+1


source


You can try replacing <br />

with /n

. This should fix your problem.

0


source







All Articles