我不能让它发挥作用。我在控制台上没有任何错误。该列表根本没有出现。
这是我的HTML代码:
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script src="/static/js/typeahead.jquery.js"></script>
<form method="POST" class="search-form" name="search-form">
<input id="keywords" name = "searchtext" type="text" class="search-input" placeholder="Enter your text..." autocomplete="off">
<button type="submit" class="search-submit">Search Now</button>
</form>
<script type="text/javascript">
$(function(){
// applied typeahead to the text input box
$('#keywords').typeahead({
name: 'keywords',
// data source
local: ['pattern recognition', 'supervised learning', 'support vector machines'],
// max item numbers list in the dropdown
limit: 10
});
});
</script>