内容简介:http://stackoverflow.com/questions/12827483/bootstrap-show-all-typeahead-items-on-focus
当文本输入(id =“问题”)获取焦点时,我想显示所有Typeahead项目.
我该怎么做?
使用Javascript:
function SetTypeahead() { $("#Questions").typeahead({ minLength: 0, source: [ "Q1?", "Q2?", "Q3?", "@4?" ] }); }
获取最新的bootstrap typeahead插件v2.1.2
此更新将允许最小长度为零以启用全部显示
<input id="typeaheadField" name="typeaheadField" type="text" placeholder="Start Typing"> $("#typeaheadField").typeahead({ minLength: 0, items: 9999, source: ["Alabama","Alaska","Arizona","Arkansas","California","Colorado", "Oregon"] });
那么你必须将onFocus事件附加到你的元素,因为它没有被插件定义:
$("#typeaheadField").on('focus', $("#typeaheadField").typeahead.bind($("#typeaheadField"), 'lookup'));
在本地覆盖引导类型头css类也是一个好主意,为结果设置最大高度和垂直滚动,以防结果过多.
.typeahead { max-height: 200px; overflow-y: auto; overflow-x: hidden; }
http://stackoverflow.com/questions/12827483/bootstrap-show-all-typeahead-items-on-focus
以上所述就是小编给大家介绍的《twitter-bootstrap – Bootstrap – 显示焦点上的所有类型头项》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:- 虚拟机磁盘扩容(适合所有lvm类型)
- 一文搞懂Python中的所有数组数据类型
- Chrome 的内置页面可显示“过渡式插入”警告的所有类型
- 如何监视 WPF 中的所有窗口,在所有窗口中订阅事件或者附加 UI
- 将所有类定义为Scala中的情况,只是让所有参数自动生成属性是否正确?
- Python捕获所有异常
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Data Structures and Algorithm Analysis in Java
Mark A. Weiss / Pearson / 2011-11-18 / GBP 129.99
Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course wa......一起来看看 《Data Structures and Algorithm Analysis in Java》 这本书的介绍吧!