Can't Get Typeahead.js To Work
The input box shows up, but the typeahead feature dosn't work. It uses the latest jquery and typeahead.bundle.min.js libraries. <
Solution 1:
Try including full path to typeahead , using Bloodhound
. See Typeahead - Examples
<!doctype html><htmllang="en"><head><title></title><scriptsrc="http://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script></head><body><divstyle="width: 1000px; height: 300px;"><divstyle="float: left; width: 500px"><h3>Hungry?</h3><inputclass="typeahead"type="text"placeholder="Food Item"autocomplete="off"></div></div><scriptsrc="http://twitter.github.io/typeahead.js/releases/latest/typeahead.bundle.js"></script><scripttype="text/javascript">
$(document).ready(function() {
var food = newBloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
local: ["Spinach", "Kale", "Coconut", "Avocado", "Banana", "Granola", "Beets"]
});
$('.typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1
}, {
name: 'RealFood',
source: food
});
});
</script></body></html>
Post a Comment for "Can't Get Typeahead.js To Work"