使用Bootstrap-3-Typeahead添加新标签

时间:2016-08-24 13:46:21

标签: jquery meteor bootstrap-typeahead

我正在使用Bootstrap-3-Typeahead

我试图在我的流星项目中动态添加标签,我提到了Bootstrap tagsinput add tag with id and value,但仍然遇到了同样的错误。

Uncaught Can't add objects when itemValue option is not set

我使用的代码是:

$("input[name='skills']").tagsinput({
    typeahead: {
            source: data,
            itemValue: 'id', 
            itemText: 'label' ,
        },
});
$('input[name="skills"]').tagsinput('add', { id: 'tag id', label: 'tag lable' });

我还试图在addItem中使用Bootstrap-3-Typeahead选项添加标签,但无法实现

$("input[name='skills']").tagsinput({
    typeahead: {
            source: data
        },
     addItem: true,
});

任何身体都可以帮我添加新标签以及Bootstrap-3-Typeahead,提前致谢!

0 个答案:

没有答案