Extend jQuery UI
$.widget("ui.autocomplete", $.extend({}, $.ui.autocomplete.prototype, {
_search: function (value) {
this.pending++;
this.element.addClass("ui-autocomplete-loading");
this.cancelSearch = false;
this.source({ term: value }, this._response());
}
}));
// add some functions (or override some functions)
// e.g. $(selector).autocomplete("doMore", data);
$.widget("ui.autocomplete", $.ui.autocomplete, {
doMore: function (data) {
// this = autocomplete object
// this.element = auto complete input element
},
overRideBlur: function() {
this._on(this.element, {
blur: function (event) {
// the standard blur code
if (this.cancelBlur) {
delete this.cancelBlur;
return;
}
clearTimeout(this.searching);
this.close(event);
this._change(event);
// raise an extra event
$(this.element).trigger("autocompleteblur");
}
});
}
});