如何在引导材料设计的输入文本中使标签支持



>我在这里创建了一个小提琴,但它在给出输入标签时显示错误。 我希望标签在单击输入文本时向上显示,并且可以在输入文本中添加标签

.html

<form>
                                    <div class="md-form form-width">
                                        <input type="text" id="form41"  class="form-control tags">
                                        <label for="form41" class="">Keywords/Tags (Type 5 to 20 items)  </label>
                                    </div>
                                </form>

.js

<script>
        // Material Select Initialization
        $(document).ready(function() {
            $('.mdb-select').material_select();

      $('.tags').tagsinput({
        allowDuplicates: true
    });
        $('.tags').on('itemAdded', function(item, tag) {
        $('.items').html('');
        var tags = $('.tags').tagsinput('items');
        $.each(tags, function(index, tag) {
            $('.items').append('<span>' + tag + '</span>');
        });
    });
});

从控制台错误消息中,我会说您还需要导入jQuery:

(索引(:69 未捕获的引用错误:未定义 $ bootstrap.min.js:6 未捕获错误:Bootstrap 的 JavaScript 需要 jQuery

最新更新