当我尝试使用typeahead在输入字段上实现自动完成搜索时,它不起作用,并且控制台中未显示任何错误。帮我解决这个问题。
这是我的代码:
<head>
<link rel="stylesheet" href="<?php echo base_url() ?>css/bootstrap.min.css" />
<!-- jQuery library -->
<script src="<?php echo base_url() ?>js/jquery-3.1.1.min.js"></script>
<!-- Latest compiled JavaScript -->
<script src="<?php echo base_url() ?>/js/bootstrap.min.js"></script>
<script src="<?php echo base_url() ?>js/jquery-typeahead/dist/jquery.typeahead.min.js"></script>
<link rel="stylesheet" href="<?php echo base_url() ?>js/jquery-typeahead/dist/jquery.typeahead.min.css">
</head>
<body>
<input type="text" name="icon" value="fa-quote-left" id="icon" placeholder="Icon" class="form-control typeahead" autocomplete="off" data-provide="typeahead">
<script type="text/javascript">
$(document).ready(function() {
$('.typeahead').typeahead({
source: ['abc',dfg','jkhdk','uihfasdhj']
});
});
</script>
</body>