I'm using the bootstrap-typehead function to implement an autocomplete box.
$(function() {
var availableTags = [ "test1", "test2","test3",....];
$('.typeahead').typeahead({
source: availableTags
});
});
});
Whereas this works, free text can also be as input. I've noticed many people wanting this functionality and no good explanation for a solution. What is the best way of modifying this so that entries are only matched to those of availableTags? e.g. if "hello" was entered, it is cleared.
The reason why I want this functionality as opposed to an normal dropdown is that there are thousands of availableTags. Scrolling down a long list seems illogical. Thanks