【发布时间】:2015-11-07 13:28:56
【问题描述】:
显示输入框,但预输入功能不起作用。它使用最新的 jquery 和 typeahead.bundle.min.js 库。
<!doctype html>
<html lang="en">
<head>
<title></title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="typeahead.bundle.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('.typeahead').typeahead({
name: 'RealFood',
source: ["Spinach", "Kale", "Coconut", "Avocado", "Banana", "Granola", "Beets"]
});
});
</script>
</head>
<body>
<div style="width: 1000px; height: 300px;">
<div style="float: left; width: 500px">
<h3>Hungry?</h3>
<input class="typeahead" type="text" placeholder="Food Item" autocomplete="off">
</div>
</div>
</body>
</html>
【问题讨论】:
标签: javascript jquery typeahead.js typeahead