Change the Color Of Certain Words In Textarea using Jquery?
How to开发者_运维百科 Change the Color Of Certain Words In Textarea using Jquery ?
For instance, i have a textarea <textarea id="txt"> </textarea>
When i type into the textarea, certain words like "is, a , was ..." should be colored or highlighted.
The aim is to create a ultra simple HTML syntax highlighter for my project that's all !
This is completely impossible.
You need to use a content-editable <iframe>
.
The reason it's not possible is that the <TEXTAREA>
has no ability, in any browser, to support formatting. You need a differnt kind of element, so that words can be wrapped in elements, formatting the text.
You can color the text in a Textarea, NobleCount provides the possibility to change via css the font color in a Textarea right after maxlength, using jQuery, see here at example num. test7. Now all we have to figure out is how to only color certains sections, or how to color by starting and-or ending at a defined charactor count.
精彩评论