I am trying to integrate twitter typeahead.js, for this I downloaded the library from https://github.com/twitter/typeahead.js and included typeahead.bundle.min.js
I then added the following
<input type="text" class="form-control typeahead font-normal">
$('.typeahead').typeahead({
source: function(query, process) {
console.log(query);
}
});
The problem is it does trigger the source function, I am expecting that it prints the query in console. which it does not.
What could be possibly wrong here?
Thanks.
Following solution worked.
As pointed in the answer, I added the following library first
- jquery.min.js
- typeahead.bundle.min.js (https://twitter.github.io/typeahead.js/)
- typeahead.jquery.min.js (https://twitter.github.io/typeahead.js/)
- bootstrap3-typeahead.min.js (https://github.com/bassjobsen/Bootstrap-3-Typeahead)
And then initialized the following code
$('.typeahead').typeahead({
source: function(query, process) {
process([
{id: "1", name: "Display name 1"},
{id: "2", name: "Display name 2"}
]);
}
});
And it works.