How to render HTML inside textarea?

Spread the love

Sometimes, we want to render HTML inside textarea.

In this article, we’ll look at how to render HTML inside textarea.

How to render HTML inside textarea?

To render HTML inside textarea, we add a contenteditable div.

For instance, we write

<div contenteditable="true"></div>

to add a contenteditable div.

Then we write

div {
  width: 300px;
  height: 200px;
  border: 1px solid #ccc;
  padding: 5px;
}

strong {
  font-weight: bold;
}

to add some styles to the div.

Conclusion

To render HTML inside textarea, we add a contenteditable div.

Leave a Reply

Your email address will not be published. Required fields are marked *