Skip to content Skip to sidebar Skip to footer

Live Text Color Change In Javascript

Possible Duplicate: Change the Color Of Certain Words In Textarea using Jquery? I'm working on a small project right now. I have a textarea that the user types words into. While

Solution 1:

This isn't possible with current technology using a textarea. You can change the color of everything in the textarea, but textareas do not have the capability to selectively style some words but not others.

Solution 2:

As has been said before, it's not possible to achieve the required level of control over presentation in a regular textarea.

Here are a couple of stackoverflow questions on the issue:

You could look at using something like codepress and editing the source code to highlight the words you want.

Or if you wanted to do it from scratch you could use <div contentEditable="true"></div> instead of a textarea as suggested here: colorize text in textarea with jQuery

Here is some example code without the jquery span replacement: http://jsfiddle.net/s5uaJ/

Good luck

Post a Comment for "Live Text Color Change In Javascript"