简体   繁体   中英

Not able to render HTML tags inside textarea content

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

My JSON response is:
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.

On rendering it is not taking a new line and displaying <br/> as it is(taking as static content). I used handlebars {{{content}}} but not helpful.

You simply can't enter HTML inside a textarea, you can only insert pure text.

You may want to use an editable div ( <div contenteditable="true">...</div> )

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

如果您希望呈现HTML,则应使用contenteditable来执行此操作。

You can try replacing <br /> with /n . That should resolve your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM