我正在尝试将Twitter的预先插件插入我的网页。我可以从Web检查器看到jquery使用特定的id属性查找我的输入,但是,当我开始输入输入时,自动完成功能不起作用。这是我的代码:
HTML:
<input type="text" class="form-control" placeholder="Customer finder..." id="typeahead_customer_data" />
jQuery的:
<script type="text/javascript">
$(document).ready(function() {
$("#typeahead_customer_data").typeahead({
name: "customer",
displayKey: "customer",
prefetch: "/assets/autocomplete/typeahead_customer_data.json",
limit: 10
});
});
</script>
JSON:
["Customer 1","Customer 2","Customer 3","Customer 4","Customer 5","Customer 6","Customer 7","Customer 8","Customer 9","Customer 10"]
我已经尝试了所有我想到的工作,但是当我开始输入时,我尝试的任何东西都不会自动完成。任何帮助表示赞赏。