typeahead.js 和 jquery,使用 typeahead.js 中的示例。脚本似乎都正确加载,但在输入时没有任何反应。
<script src='http://code.jquery.com/jquery.min.js'></script>
<script src='typeahead.min.js'></script>
<script src='http://twitter.github.io/hogan.js/builds/2.0.0/hogan-2.0.0.js'></script>
<input class="typeahead" type="text" placeholder="stuff" autocomplete="off" spellcheck="false" dir="auto" style="position: relative; vertical-align: top; background-color: transparent;">
<script>
$(function(){
$('.typeahead').typeahead({
name: 'twitter-oss',
prefetch: './repos.json',
template: [
'<p class="repo-language">{{language}}</p>',
'<p class="repo-name">{{name}}</p>',
'<p class="repo-description">{{description}}</p>'
].join(''),
engine: Hogan
});
})
</script>
// repos.json
[
{"name":"Joe", "description":"Person", "language":"en"}
]