初始化taginput引导程序的未定义函数3 [英] undefined function initializing taginput bootstrap 3
问题描述
我正在尝试为bootstrap 3实现 TagInput ,但是当我尝试使其初始化,它给我一个错误Uncaught TypeError: Property 'undefined' of object #<TagsInput> is not a function
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()
的调用,有2个对tagsinput()
的调用.
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.
要解决此问题,请注释上面的代码. (但也许您可以使用某些功能,但不能使用importan
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.
这篇关于初始化taginput引导程序的未定义函数3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!