Is it possible to have several different textcolors in one textarea?
You can't do this inside a <textarea>
, not one that's editable. It sounds like you're after a WYSIWYG editor, most of which use a <iframe>
to do this.
There are several JavaScript options for this, to name a few:
- TinyMCE
- CKEditor
You cannot do this with a textarea or input tag. However, as @naikus mentioned, you can use the contenteditable attribute. It is as follows:
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span>
and I have a friend name <span style="color: green;">Joe</span>.
</div>
<div id="mytxt" contenteditable="true">
Hello, my name is <span style="color: blue;">Bob</span> and I have a friend name <span style="color: green;">Joe</span>.
</div>