我只是试图在HTML5项目中做一个简单的Bootstrap typeahead插件示例。我试图在input元素中提供数据源属性。这些例子看起来很简单,但它对我来说不起作用。Bootstrap typeahead数据源属性
它看起来像bootstrap工作,并调用JavaScript。当我在输入中输入一个字符时,显示下拉列表,但只显示第一个字符(而不是整个字)。
这是我的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Rober HTML5 Bootstrap Sample</title>
<!-- CSS files -->
<link href="bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="bootstrap/css/bootstrap-responsive.css" rel="stylesheet" />
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body>
<h1>Welcome to my HTMl5 Bootstrap example!</h1>
<div class="well">
<input type="text" class="span3" data-provide="typeahead" data-items="4" placeholder="Introduce un país"
data-source="['Alabama', 'California', 'Marte']" >
</div>
<!-- Javascript files - At the end of the page load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"> </script>
<script src="bootstrap/js/bootstrap.js"></script>
</body>
</html>