JSFiddle - React, Tailwind, and code Playground
HTML
<link rel="stylesheet" href="http://www.w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/docs/assets/css/bootstrap.css">
<script src="http://www.w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/docs/assets/js/jquery.js"></script>
<script src="http://cdn.mobilehoney.org/mhnystatic/vendor/bootstrap-2.2.2/js/bootstrap.min.js"></script>
<br>
Typeahead displays these results because they all have the word "great" in them:
<br>
<input id="title" class="title input-xlarge" placeholder="Put the title here..." type="text" value="great t" style="">
<br> <br> <br>
Typeahead second-guesses my results and filters them for me :(
<br>
<input id="title2" class="title input-xlarge" placeholder="Put the title here..." type="text" value="greatt" style="">
JavaScript
$("#title").typeahead({
source: function( request, response ) {
var mockResults1 = ["Great Tank War","Great Train Robbery","Great Clips",
"Alexander the Great"];
response(mockResults1);
}
});
$("#title2").typeahead({
source: function( request, response ) {
var mockResults2 = ["Great Tank War",
"Great Train Robbery",
"whatever other random result my server produced"];
response(mockResults2);
// I expect this to display both items regardless of $("#title2").val()
// In my case, the server was smart enough to realize that "greattank" may match "great tank"
}
});