I need to be able to render specific HTML tags (particularly strong>, I u>, and a>) within a textarea, however textareas only interpret their content as text. Is there a simple method to do that without relying on third-party libraries or plugins (I’m using jQuery)? If not, do you know of any jQuery plugins that I might use?
Asked by The Coding Monk
With a textarea, this is not possible. You’re seeking for a content editable div, which is simple to create:
Answered by mekwall
The method document can be used with an editable div. execCommand (details) to quickly offer support for the tags you supplied, as well as several additional features.
Answered by Sampath Liyanage
Yes, you can, as you merely said render. You may try something similar to this:
Answered by merlin
try this example
Answered by david grinstein
I’d like to contribute something to this. You can utilize character entities to render in the textarea (for example, altering div> to div>). When it’s saved, though, the textarea’s value is the rendered text. As a result, there is no need to decode. I just tried it in a few other browsers (ie back to 11).
Answered by axlotl
Post is based on https://stackoverflow.com/questions/4705848/rendering-html-inside-textarea