如何修改jquery-ui的autocomplete,让它支持参数自定义

2026年09月26日 16:36
有1个网友回答
网友(1):

1 在$.widget( "ui.autocomplete", {中的options中加入term:'term'
2 在_search: function( value ) {方法中,
this.source({term:value}, this._response())替换成

var option = {};
option[this.options.term] = value;
this.source(option, this._response());

3 然后就可以在页面中.autocomplete({term:'abc'})来传参了