[英]How to highlight text in TextArea
How can I highlight some portion of the text in TextArea? 如何在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?
如何使用jQuery或简单的JavaScript?
Unfortunately the textarea
element is plain text only. 不幸的是,
textarea
元素仅是纯文本。 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). 您将需要使用诸如FCKeditor或TinyMCE之类的WYSIWYG编辑器(或者,如果您只需要突出显示,则可以使用带有
designmode
或contenteditable
的div
滚动自己的窗口小部件)。 This might help you along. 这可能会帮助您。 Good luck!
祝好运!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.