hi i am using ajax autocomplete for jquery plugin
http://www.devbridge.com/projects/autocomplete/jquery/
there is a code
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);
}
in there
this.options = {
autoSubmit: false,
minChars: 1,
maxHeight: 300,
deferRequestBy: 0,
width: 0,
highlight: true,
params: {},
fnFormatResult: fnFormatResult,
delimiter: null,
zIndex: 9999
};
it has define a function to format the result
fnFormatResult: fnFormatResult,
i want to use a function other than fnFormatResult like fnFormatResult2 .
i want to change the calling function acording to a parameter pass to the plugin
i need to do like this
if(param == 1){
fnFormatResult: fnFormatResult,
}
else if(param == 1){
fnFormatResult: fnFormatResult2,
}
how can i do this . please help………………….
Hmm, I guess you can do: