How can I use typeahead.js with bootstrap 3?

I am building a prototype application for demonstration, and using Twitter Bootstrap 3 ( http://getbootstrap.com - specifically version 3.1.1). I would like to use typeahead.js ( http://twitter.imtqy.com/typeahead. js / - currently version 0.10.1) to search for search suggestions.

I saw several examples for previous versions, but none of them apply to the latest versions.

What is the best way to integrate the two?

Based on a few examples that I saw, this is what I'm trying to do

<input type="text" class="typeahead form-control input-sm" id="searchField1"/>

and then

$(document).ready(function() {
  $('#searchField1').typeahead({
    name: 'keywords',
    local: ['foo', 'bar']
  });
});

However, I think things have moved on.

+4
source share

Source: https://habr.com/ru/post/1531031/


All Articles