如何在TextArea中突出显示文本 [英] How to highlight text in TextArea
问题描述
如何在TextArea中突出显示文本的某些部分?例如,我具有文本的开始和结束位置,并且需要将其背景颜色更改为黄色.我该如何使用jQuery或简单的JavaScript?
How can I highlight some portion of the text in TextArea? For example I have start and end position of the text and I need change its background color to yellow. How can I do this using jQuery or simple JavaScript?
推荐答案
不幸的是,textarea
元素仅是纯文本.您将需要使用FCKeditor或TinyMCE之类的WYSIWYG编辑器(如果只需要突出显示,则可以基于div
和designmode
或contenteditable
滚动自己的窗口小部件). 这可能会帮助您.祝你好运!
Unfortunately the textarea
element is plain text only. You'll need to use a WYSIWYG editor like FCKeditor or TinyMCE (or roll your own widget based on a div
with designmode
or contenteditable
if you only need highlighting). This might help you along. Good luck!
这篇关于如何在TextArea中突出显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!