A bit more reasonable autocomplete (II)

This commit is contained in:
Marcin Kurczewski 2013-10-21 15:10:25 +02:00
parent 9f5bdc3da0
commit 83355f3789

View file

@ -192,7 +192,10 @@ function getTagItOptions()
var term = request.term.toLowerCase();
var results = $.grep(this.options.availableTags, function(a)
{
return a.toLowerCase().indexOf(term) != -1;
if (term.length < 3)
return a.toLowerCase().indexOf(term) == 0;
else
return a.toLowerCase().indexOf(term) != -1;
});
if (!this.options.allowDuplicates)
results = this._subtractArray(results, this.assignedTags());