Eric Ilavia
Eric Ilavia

Reputation: 91

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

Upvotes: 4

Views: 6268

Answers (1)

Engineer
Engineer

Reputation: 48793

Instead of textarea you can use div with contenteditable attribute:

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

Upvotes: 8

Related Questions