Javascript – Change font color of certain text in textarea

contenteditablejavascriptrichtextboxtextareawysiwyg

Is there any JS function that can change the color of certain text in a textarea?

For example, blar blar {blar} blar, {blar}, including { }, will be in blue. Other words will be in blank. In other words, all I need is a function that can change color of all text in { }.

I've done some studies and it seems that most people say it can't be done. But I'm seeing rich text editors or those wysiwyg editors having the ability to bold or underline words. There must be a way to do it.

Any suggestion is welcome.

Best Solution

No one mentioned contentEditable?
Just make a contentEditable div and use javascript to style it.
I reccommend you to look into the Dojo Toolkit's.
It has a Editor widget.

Other resources:
Some contentEditable problems in IE.
How to use contentEditable with jQuery or without it.