Twitter bootstrap 3 bootstrap标记输入带前置类型,bootstrap-3

Twitter bootstrap 3 bootstrap标记输入带前置类型,bootstrap-3,twitter-bootstrap-3,bootstrap-typeahead,typeahead,twitter-typeahead,jquery-tags-input,Twitter Bootstrap 3,Bootstrap Typeahead,Typeahead,Twitter Typeahead,Jquery Tags Input,在我的一个项目中,我曾经在bootstrap-2.3.2中放过bootstrap标签。最近,我将引导更新为3,将tagsinput更新为0.3.9。在更新过程中,我发现tagsinput外部依赖于 根据文档,我试着使用bs标签和typeahead。那有点颠簸。例如,引导标记Input docs下的typeahead代码示例: $('input').tagsinput('input').typeahead({ prefetch: 'citynames.json' }).bind('typeah

在我的一个项目中,我曾经在bootstrap-2.3.2中放过bootstrap标签。最近,我将引导更新为3,将tagsinput更新为0.3.9。在更新过程中,我发现tagsinput外部依赖于

根据文档,我试着使用bs标签和typeahead。那有点颠簸。例如,引导标记Input 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 1.0版中不再存在,它在0.9版中也不再存在。我对数据集使用typeahead.source方法。0.9中未实现“源”的typeahead,因此降级似乎不是一个选项。我不确定是否要用typeahead['val']替换它,但这两种方法都不能解决我所看到的问题。 至于CSS,我是从bootstrap标签put docs页面复制过来的-我不确定这是我的初学目的,所以我不太清楚

问题是,在把所有的东西都放在一起之后,我意外地遇到了预期的错误行为。具体地说,我面临一个问题,在插入标签后键入一个单词并按enter键: 1 tt下拉菜单应消失,但不会消失。它与前面的tt建议列表保持一致 和 2 tt提示字段应清除,但未清除

如果我使用箭头选择tt建议中的一个,那么提到这个问题不会发生可能会很有用


有人知道什么是恢复tagsinput-w/typeahead功能的最佳方法吗?

经过进一步挖掘,我在这里找到了答案:

长话短说,看起来像bootstrap tagsinput和typeahead.js 1.0,因为css/其他不兼容,所以不能很好地发挥作用

这个项目thanku@Basjobsen帮我解决了这个问题。它将bootstrap typeahead从2.3.2向后移植到bootstrap-3。API没有改变,到目前为止,它与bootstrap tagsinput配合得很好

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

您可以使用这个Typeahead,它与TwitterBootstrap3兼容


实际上,开发人员已将bootstrap 2代码迁移到bootstrap 3中,以下是详细信息

如何从标记输入中调用typeahead?老实说,我不确定,我使用的是bootstrap标记输入,它只是在机箱中工作,我已经让它工作了。谢谢你的回复。我认为当您使用Bootstrap 2中的示例时,它是有效的。我正在用你链接的typeahead尝试Bootstrap3中的示例。啊,是的。由于bootstrap标记put是后端口的,因此使用它的方式与在bootstrap-2.3.2中使用它的方式相同,请参见:。您可以使用$'.typeahead'.tagsinput{typeahead:{source:[阿拉巴马州,阿拉斯加]};很好,我只在引导中使用了typeahead,但没有工作。试试这个。tagsinput'input'。typeahead'val';而不是用于清除输入的setQuery。