Hi I am using typeahead in twitter bootstrap. What I found here is that in autocomplete dropdown, it selects first option by default. My requirement is that initially it should have nothing selected, it goes to first option only when I press navigation key (up or down) or when I hover over it. Is it possibe using typeahead.
To avoid selection by typeahead first option by default, I used parameter documented in official docs: autoSelect. By default it set to 'true'
My code:
$('#searchString', this.el).typeahead({
source: function (query, process) {
var q = '/autocompleteSearch?searchString=' + query;
return $.get(q, function (data) {
return process(data);
});
},
minLength: 3,
autoSelect: false
});
There is the more powerfull typeahead project from Twitter which doesn't have this problem. I don't understand why this project is not included directly in Twitter Bootstrap.
You can see here some examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With