Bootstrap   发布时间:2022-04-18  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了twitter-bootstrap-3 – bootstrap-tagsinput with typeahead,bootstrap-3大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
在我的一个项目中,我曾经在bootstrap-2.3.2中使用bootstrap-tags输入 http://timschlechter.github.io/bootstrap-tagsinput.最近我更新了两个(bootstrap为3,tagsinput为0.3.9).在更新期间,我发现外部的tagsinput取决于 http://twitter.github.io/typeahead.js/.

我尝试根据文档使用bs-tagsinput和typeahead.那有点颠簸.例如,bootstrap-tagsinput docs下的typeahead代码例:

$('input').tagsinput('input').typeahead({
  prefetch: 'citynames.json'
}).bind('typeahead:SELEcted',$.proxy(function (obj,datum) {  
  this.tagsinput('add',datum.value);
  this.tagsinput('input').typeahead('setQuery','');
},$('input')));
</script>

typeahead [‘setQuery’]不再存在于typeahead ver 1.0中(它在ver 0.9中).我对数据集使用typeahead.source方法.来自’source’的typeahead没有在0.9中实现,因此降级似乎不是一个选项.我不确定是否用typeahead [‘val’]替换它(尽管两者都没有解决我看到的问题).
至于CSS,我从bootstrap-tagsinput docs页面复制了它 – 不确定这是意图(我是新手,所以我不知道更好).

问题是,把所有东西放在一起后,我遇到了错误的行为(如预期的那样).具体来说,我在插入标签(输入一个单词并按下回车)后面临一个问题:
(1)tt -down-down菜单应该消失但是没有.它与之前的tt-suggestions列表一起发布

(2)tt-hint字段应该被清除但不是

如果我使用箭头选择其中一个tt-advice,就不会发生这个问题

有谁知道什么是获取tagsinput-w / typeahead功能的最佳方法

解决方法

twitter.github.io/typeahead.js与bootstrap 3不兼容.

您可以使用与twitter bootstrap 3兼容的Typeahead

https://github.com/bassjobsen/Bootstrap-3-Typeahead

实际上开发人员将bootstrap 2代码迁移到bootstrap 3这里的细节是http://bassjobsen.weblogs.fm/migrate-your-templates-from-twitter-bootstrap-2-x-to-twitter-bootstrap-3/

大佬总结

以上是大佬教程为你收集整理的twitter-bootstrap-3 – bootstrap-tagsinput with typeahead,bootstrap-3全部内容,希望文章能够帮你解决twitter-bootstrap-3 – bootstrap-tagsinput with typeahead,bootstrap-3所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。