colorize text in textarea with jQuery

烈酒焚心 提交于 2019-12-13 13:00:19

问题


i need to colorize part of the text in textarea. Let's say first line in red, second in blue. How to do this? (jQuery)


回答1:


I'm not sure if it possible with textarea. Instead use div contentEditable.

See similar questions

Rendering HTML inside textarea

How to set background color for some inner text of HTML textarea element?




回答2:


You can't easily style the contents of a text area, you can however use a simplified rich text editor to accomplish this.

something like RTE: http://batiste.dosimple.ch/blog/posts/2007-09-11-1/rich-text-editor-jquery.html or CLEditor: http://premiumsoftware.net/cleditor/ would be a good starting point for this.



来源:https://stackoverflow.com/questions/5498005/colorize-text-in-textarea-with-jquery

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!