如何在TextArea中突出显示文本 [英] How to highlight text in TextArea

查看:81
本文介绍了如何在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编辑器(如果只需要突出显示,则可以基于divdesignmodecontenteditable滚动自己的窗口小部件). 可能会帮助您.祝你好运!

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆