Live Text Color Change In Javascript
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:
- Textarea that can do syntax highlighting on the fly?
- https://stackoverflow.com/questions/1505761/textarea-with-syntax-code-highlighting
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"