【发布时间】:2016-10-07 06:09:46
【问题描述】:
我正在尝试理解 jquery 提到的插件 jquery mentions,我在插件中遇到了这个部分。谁能解释这是什么意思?最后一个返回函数特别做什么? 当匹配值的长度小于 4 时,我想关闭自动完成下拉列表
search: function (value, event) {
var match, pos;
//&& value.length >= this.options.minChars
if (!value) {
//sel = window.getSelection();
//node = sel.focusNode;
value = this._value();
pos = Selection.get(this.element).start;
value = value.substring(0, pos);
match = this.matcher.exec(value);
if (!match || match[1].length <= this.options.minChars) {
return '';
}
this.start = match.index;
this.end = match.index + match[0].length;
this.searchTerm = match[1];
//this._setDropdownPosition(node);
}
return $.ui.autocomplete.prototype.search.call(this, this.searchTerm, event);
}
【问题讨论】:
标签: javascript jquery oop jquery-ui