The Coding Monk The Coding Monk - 7 months ago 194
Javascript Question

Rendering HTML inside textarea

I need to be able to render some HTML tags inside a textarea (namely <strong>, <i>, <u>, <a>) but textareas only interpret their content as text. Is there an easy way of doing it without relying on external libraries/plugins (I'm using jQuery)?
If not, do you know of any jQuery plugin I could use to do this?


This is not possible to do with a textarea. What you are looking for is an content editable div, which is very easily done:

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

Check this small demo on jsFiddle.

Edit: Thanks to Tim Down for pointing out that no JavaScript is needed.