本文介绍了无法让Twitter Typeahead在Bootstrap中工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这可能是一个菜鸟问题,但是我无法弄清楚为什么此代码无法正常工作.仅供参考,这只是从仅有几个州的州抽出的县的示例列表.我根据较早的输入从php中提取了列表,但这不是问题,列表很好,其自动完成功能不起作用.
This might be a noob issue, but I cannot figure out why this code is not working. FYI this is just a sample list of counties pulled from a state with just a few. I pull the list from php based on earlier inputs, but that is not the issue, the list is fine, its autocomplete not working.
jsfiddle/s4wx9/
<div>Local County: <input type="text" class="input-block-level required typeahead" id="county" name='county' placeholder="Local County" /> <div> <script> $("#county").typeahead({ local: ["Apache", "Cochise", "Coconino", "Gila", "Graham", "Greenlee", "La Paz", "Maricopa", "Mohave", "Navajo", "Pima", "Pinal", "Santa Cruz", "Yavapai", "Yuma"] }); </script>推荐答案
只需在JavaScript中将local替换为source
Just replace local by source in your javascript
$("#county").typeahead({ source: ["Apache", "Cochise", "Coconino", "Gila", "Graham", "Greenlee", "La Paz", "Maricopa", "Mohave", "Navajo", "Pima", "Pinal", "Santa Cruz", "Yavapai", "Yuma"] });本地与独立的Typeahead库一起使用.
Local is used with the standalone Typeahead library.
这是更新的jsfiddle: jsfiddle/s4wx9/1/
Here's an updated jsfiddle: jsfiddle/s4wx9/1/
更多推荐
无法让Twitter Typeahead在Bootstrap中工作
发布评论