使用Typeahead的Bootstrap Tagsinput不起作用

Isu*_*mal 12 jquery twitter-bootstrap-3

这是参考http://timschlechter.github.io/bootstrap-tagsinput/examples/bootstrap3/中的"Bootstrap Tagsinput"

使用的插件:(最新版本)

  • Bootstrap 3
  • typeahead.js
  • 引导-tagsinput.min.js

我想要的是使用Typeahead输入字段来添加标签.

<div class="input-group col-sm-4">
    <input type="text" class="form-control" id="tagsinput" />
</div>
Run Code Online (Sandbox Code Playgroud)

jQuery部分如下.

$('#tagsinput').tagsinput({
    typeahead: {
        name: 'towns',
        local: ['Amsterdam', 'Washington', 'Sydney', 'Beijing', 'Cairo']
    }
});
Run Code Online (Sandbox Code Playgroud)

我分别尝试了文档页面和打印文档页面.但没有找到任何解决方案.我实际上正在测试这个简单的代码,所以我需要使用数据库来解决类似问题.但即使它不适用于本地数据.

小智 -1

该功能自 3.0 起已被删除。http://blog.getbootstrap.com/2013/08/19/bootstrap-3-released/ 所以你必须单独包含 typeahead.js http://getbootstrap.com/2.3.2/assets/js/bootstrap- typeahead.js 希望这能有所帮助,并且这在我的本地有效。

  • 我单独添加了 typeahed.js 并且使用 Bootstrap 3。 (2认同)