出于某种原因,基本的typeahead示例在我的任何网络服务器上都不起作用,但是我能够在这里工作 - http://jsfiddle.net/H4Qmh/12/
以下代码中的任何差异或问题与jsfiddle上发布的代码相比较?你能确认下面的代码适合你吗? (您应该只能通过输入h,i或s来查看结果)
<html>
<head>
<link href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery.js" type="text/javascript"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js" type="text/javascript"></script>
</head>
<body>
<div class="well">
<input autocomplete="off" type="text" class="span3" data-provide="typeahead" data-items="4" placeholder="Type in letter h, i or s" data-source='["iPhone", "HTC", "Samsung"]' >
</div>
</body>
</html>
答案 0 :(得分:2)
我刚用bootstrap typeahead js文件替换了你的bootstrap。它开始运行。
https://github.com/biggora/bootstrap-ajax-typeahead/tree/master/src
答案 1 :(得分:1)
<html>
<head>
<!-- jquery-->
<script src="https://code.jquery.com/jquery.js"></script>
<!-- Bootstrap -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.js"></script>
</head>
<body>
<div class="well">
<input autocomplete="off" type="text" class="span3" data-provide="typeahead" data-items="4" placeholder="type in letter h, i or s" data-source='["iPhone", "HTC", "Samsung"]'>
</div>
</body>
</html>
您的bootstrap cdn
链接返回了HTML
个文件,而不是CSS
个文件。