Share
Render HTML inside a textarea
Question
I was wondering if it’s possible to render HTML inside a textarea? So if I place HTML content in it, it would be instantly rendered and displayed.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Answer ( 1 )
You can’t really render HTML in a textarea. What you can do is to add a separate div with the contenteditable attribute set to true. And display the textarea content into that div.
You would want to do something like this:
and then inject the content of the textarea into the div with javascript
Note that this is not instant. For that you would probably need some more Javascript magic.