I've been trying to get typeahead.js to work for 2 days now, and I refuse to believe it should be this hard. Not a single example have worked so far, and I'm stuck with figuring out what is going wrong.
First of all, my typeahead.bundle.js file is downloaded from this repository:
https://github.com/twitter/typeahead.js/tree/master/dist
My code looks like this:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Typeahead example</title>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
</head>
<body>
<input id="search"/>
<!-- jQuery -->
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<!-- Latest compiled and minified Bootstrap -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Latest Typeahead.js -->
<script src="typeahead.bundle.js"></script>
<script type="text/javascript">
var colors = ["red", "blue", "green", "yellow", "brown", "black"];
$(document).ready(function() {
$('#search').typeahead({source: colors});
})
</script>
</body>
</html>
Please help me figure this out.
EDIT: From sakir's answer, I've now changed my Javascript code to fit the version 10 syntax, but it still won't show any suggestions:
<script type="text/javascript">
var colors = ["red", "blue", "green", "yellow", "brown", "black"];
$(document).ready(function() {
$('#search').typeahead({
highlight: true,
hint: false
}, colors);
});
</script>