你好我使用ajax autocomplete for jquery
插件如何编辑该代码在AJAX自动完成的jQuery
http://www.devbridge.com/projects/autocomplete/jquery/
有一个代码
function Autocomplete(el, options) {
this.el = $(el);
this.id = options.id;
this.el.attr('autocomplete', 'off');
this.suggestions = [];
this.data = [];
this.badQueries = [];
this.selectedIndex = -1;
this.currentValue = this.el.val();
this.intervalId = 0;
this.cachedResponse = [];
this.onChangeInterval = null;
this.ignoreValueChange = false;
this.serviceUrl = options.serviceUrl;
this.isLocal = false;
//this.options.fnFormatResult = fnFormatResult();
this.options = {
autoSubmit: false,
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
width: 0,
highlight: true,
params: {},
fnFormatResult: fnFormatResult,
delimiter: null,
zIndex: 9999
};
this.initialize();
this.setOptions(options);
}
在那里
this.options = {
autoSubmit: false,
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
width: 0,
highlight: true,
params: {},
fnFormatResult: fnFormatResult,
delimiter: null,
zIndex: 9999
};
它有定义一个函数来格式化结果
fnFormatResult: fnFormatResult,
我想使用fnFormatResult
之外的其他功能,例如fnFormatResult2
。
我想调用函数acording传递一个参数更改为插件
我需要做这样的
if(param == 1){
fnFormatResult: fnFormatResult,
}
else if(param == 1){
fnFormatResult: fnFormatResult2,
}
我怎么能做到这一点。请帮助......................
我不能帮你这个,但我知道你可以做你想要的与jquery ui自动完成 – kmcc049