无法让Twitter Typeahead在Bootstrap中工作

编程入门 行业动态 更新时间:2024-10-25 14:29:37
本文介绍了无法让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中工作

本文发布于:2023-11-24 21:47:49,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1626972.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:工作   Twitter   Typeahead   Bootstrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!