简体   繁体   中英

Put html code in textarea

I have a div whose innerHTML i want to put it in textarea, the problem is that the div content is with html tags and when i place that in textarea it does not show the executed html code but it shows text with html tags. I want the executed html code in the textarea, how can I achieve this? I have searched all through the net but not able to find it. Any kind of help will be highly appreciated

Thank you

Instead of textarea you can use div with contenteditable attribute:

<div contenteditable="true">
  This text can be edited by the user.
</div>

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