【发布时间】:2013-01-27 17:12:51
【问题描述】:
我需要在文本区域中突出显示部分文本。我已经看到它是用 jquery 完成的,但我不能使用 jquery,因为我正在开发的应用程序已经使用了 extjs(textarea 只是应用程序的一小部分)。这是 jquery 示例的链接:http://www.strangeplanet.fr/work/jquery-highlighttextarea/ 我正在使用 extjs 2.3.0
message 是 Extjs Textarea,我正在尝试突出显示文本。
var message = new Ext.form.TextArea({
hideLabel: true,
id: 'smshl',
name : 'smshl',
emptyText: 'enter message here',
anchor: '90%',
allowBlank: false,
style:'overflow:hidden;style:margin:15px;',
height: 90,
minLength: 1,
minLengthText: 'You cannot send a blank text',
maxLength: userObj.smsLength,
maxLengthText: 'Sorry, Maximum length of message exceeded',
preventScrollbars: true,
enableKeyEvents: true,
listeners:{
keyup: function() {
this.highlightTextarea({
words: ["first word","another word"]
});
}
}
})
【问题讨论】:
-
我不确定我是否理解是什么阻止了您使用您链接到的 jQuery 插件。在同一个应用程序中同时使用 ExtJS 和 jQuery 是完全可能且容易的。
-
那是因为我不知道该怎么做。我尝试使用 jquery 插件,但没有成功。我已经编辑了我的问题以包含部分代码。
-
你需要包含 jQuery 库和你的插件,试试这个教程:docs.jquery.com/Tutorials:Using_Ext_With_jQuery