Typeahead插件和Bootstrap标签输入插件Meteor无法正常工作

编程入门 行业动态 更新时间:2024-10-27 08:29:33
本文介绍了Typeahead插件和Bootstrap标签输入插件Meteor无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我们安装了'bootstrap-tagsinput.js'和'typeahead'插件,用于为我们其中一种形式的输入字段的标签做一个tyepahead下拉列表。硬编码标签正常工作。但是,预先输入部分无法正常工作。

We've installed 'bootstrap-tagsinput.js' and the 'typeahead' plugin for doing a tyepahead drop down for tags for an input field in one of our forms. The hardcoded tags work properly. However, the typeahead part doesnt work properly.

我们有以下HTML:

<div class="form-group"> <label>Types</label><br /> <input class="form-control tags" type="text" name="type" value="Wordpress, Guitar Hero" data-role="tagsinput" /> </div>

以及以下JS:

Template.form.rendered = function() { // Initialise tags input $('.tags').tagsinput({ typeahead: { source: ['Amsterdam', 'Washington', 'Sydney', 'Beijing', 'Cairo'] } }); };

在我们输入时,我们希望它能够拾取以下数据项并显示在前面的类型下拉列表中。但是,它只显示硬编码类型,当我们输入类似于源数据的内容时,它不会显示在下拉列表中。

As we type, we would like it to pickup the following data items and display in a type ahead dropdown. However, it only display the hardcoded types and when we type something similar to the source data, it does not show in a dropdown.

推荐答案

这里有同样的问题。解决了丢弃原始typeahead.js(与Bootstrap 3不兼容)并使用 bootstrap3-typeahead.js ( github/bassjobsen/Bootstrap-3-Typeahead )。

Same problem here. Resolved dropping the original typeahead.js (that is not compatible with Bootstrap 3) and using bootstrap3-typeahead.js (github/bassjobsen/Bootstrap-3-Typeahead).

此外,你不要需要添加(实际上在某些情况下你必须删除它才能工作)

Moreover, you don't need to add (actually on some occasions you MUST remove it in order to work)

data-role="tags input"

指定时

$('#my_field').tagsinput({ typeahead: ...

更多推荐

Typeahead插件和Bootstrap标签输入插件Meteor无法正常工作

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

发布评论

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

>www.elefans.com

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