我试图为 typeahead.js ( http://twitter.github.io/typeahead.js/examples/ ) 编写我自己的示例,但由于某种原因我无法让它工作。
小提琴:http: //jsfiddle.net/A8P3C/
我包含了我的 JSON,它应该从源中的“本地”调用加载。
<div class="example example-degrees">
<h2 class="example-name">Degrees</h2>
<div class="demo">
<input class="typeahead" type="text" placeholder="degrees">
</div>
$(document).ready(function() {
$('.countries .typeahead').typeahead({
name: 'degrees',
local: ["Bachelor of Science","Bachelor of Science in Accounting","Bachelor of Science in Business","Bachelor of Science in Business\/Accounting","Bachelor of Science in Business\/Administration","Bachelor of Science in Business\/Communications","Bachelor of Science in Business\/e-Business","Bachelor of Science in Business\/Finance","Bachelor of Science in Business\/Global Business Management","Bachelor of Science in Business\/Green and Sustainable","Bachelor of Science in Business\/Green and Sustainable Enterprise Management","Bachelor of Science in Business\/Hospitality Management","Bachelor of Science in Business\/Human Resource Management"]
});
我以为我可以设置一个简单的示例,但我无法让它工作
TIA