我正在學習書中的typeahead。 當我使用0.9.3 typeahead發佈時,typeahead可以正常工作。 當我使用0.11.1或0.10.0等類型的過濾器釋放時,它不再起作用。簡單typeahead.js代碼只適用於舊版本0.9.3不在後來的版本
那麼我應該在我的代碼中更改哪些內容,以便它能夠在更新的typeahead版本中使用? (我使用的是最新版本的jQuery)
<html>
<head><script type="text/javascript" src="components/jquery/dist/jquery.min.js"></script>
<script type="text/javascript" src="components/typeahead.js/dist/typeahead.jquery.min.0.9.3.js"></script>
<title>Friend Finder</title>
</head>
<body>
<label for="friends">Pick Your Friend</label>
<input type="text" name="dummy" class="typeahead"/>
<script>
$(document).ready(function() {
$('input').typeahead({
minLength: 1,
name: 'people',
local: ['Elaine', 'Column', 'Kirsty', 'Chris Elder']
});
});
</script>
</body>
</html>
附:從書中學習:Toby Osbourn的即時typeahead.js