未定义的函数初始化标记输入引导程序 3 [英] undefined function initializing taginput bootstrap 3

查看:17
本文介绍了未定义的函数初始化标记输入引导程序 3的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 bootstrap 3 实现 TagInput 但是当我尝试初始化它,它给了我一个错误 Uncaught TypeError: Property 'undefined' of object #<TagsInput>不是函数

I'm try to implement TagInput for bootstrap 3 but when i try to inizialize it, it give me a error Uncaught TypeError: Property 'undefined' of object #<TagsInput> is not a function

这是我调用脚本的方式

<script src='<?php echo base_url() ?>resources/js/jquery-1.7.2.min.js' type='text/javascript'></script>

<script src='<?php echo base_url() ?>resources/js/bootstrap.js' type='text/javascript'></script>

<script src='<?php echo base_url() ?>resources/js/bootstrap-tagsinput.js' type='text/javascript'></script>

<script> $('.tagplayer').tagsinput();</script>

表格

<input type="text" class="tagplayer">

我目前不再使用此插件,我需要建议接受正确的答案.

推荐答案

我遇到了同样的问题.可能作者修改后忘记测试了.打开bootstrap-tagsinput.js,在最后一行可以看到如下代码;

I got the same problem. May the author forgot to test after some revision. Open bootstrap-tagsinput.js, and at the last line you can see the following code;

   $(function() {
       $("input[data-role=tagsinput], select[multiple][data-role=tagsinput]").tagsinput();
   });

如你所见,在这段js代码中,调用了tagsinput()函数.因此,包括您在代码中对 tagsinput() 的调用,对 tagsinput() 的调用有 2 次.

As you can see, in this js code, tagsinput() function is called. Hence, including your call to tagsinput() in your code, there are 2 calls to tagsinput().

因此,在第 357 行,将 tagsinput() 函数注册为 jquery 插件,初始化失败.

As a result, at line 357 where registering tagsinput() function as a jquery plugin, the initializing is failed.

要解决这个问题,请注释上面的代码.(但也许你可以使用一些功能,但并不重要

To solve this, comment upper code. (But maybe you can use some functionalties, but not importan

无论如何,您也需要包含 bootstrap-tagsinput.css.

Anyway, you need to include bootstrap-tagsinput.css too.

这篇关于未定义的函数初始化标记输入引导程序 3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆