0

I'm trying to use typeahead.js 0.10 with bootstrap 3 on an input type text form.

Here is what it renders :

enter image description here

And here is my code :

// instantiate the bloodhound suggestion engine
var numbers = new Bloodhound({
datumTokenizer: function(d) { return Bloodhound.tokenizers.whitespace(d.num); },
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: [
{ num: 'one' },
{ num: 'two' },
{ num: 'three' },
{ num: 'four' },
{ num: 'five' },
{ num: 'six' },
{ num: 'seven' },
{ num: 'eight' },
{ num: 'nine' },
{ num: 'ten' }
]
});

// initialize the bloodhound suggestion engine
numbers.initialize();

// instantiate the typeahead UI
$('#search').typeahead(null, {
displayKey: 'num',
source: numbers.ttAdapter()
});

I included this file : typeahead.bundle.js to use the typeahead.

and my search form is :

<form class="navbar-form navbar-left visible-lg" role="search">
            <div class="form-group">
                <input type="text" class="form-control" placeholder="Search" id="search">
            </div>
            <button type="submit" class="btn btn-default">Go</button>
            </form>

Any ideas?

Sébastien Le Gall
  • 620
  • 1
  • 5
  • 13
  • are you using the rigth version? https://github.com/bassjobsen/Bootstrap-3-Typeahead – bto.rdz Feb 21 '14 at 15:55
  • the `.tt-hint` class is not fitting, see http://stackoverflow.com/questions/18059161/css-issue-on-twitter-typeahead-with-bootstrap-3 and http://blog.flowl.info/2013/typeahead-js-bootstrap-3/ – Daniel W. Feb 21 '14 at 15:57
  • Please check this http://stackoverflow.com/questions/18059161/css-issue-on-twitter-typeahead-with-bootstrap-3?lq=1 – Dheer Feb 21 '14 at 16:06
  • Thx you. The answer was there : https://github.com/bassjobsen/typeahead.js-bootstrap-css A just had to include this css stylesheet. – Sébastien Le Gall Feb 21 '14 at 19:04

0 Answers0