且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

未定义的函数初始化标记输入引导程序 3

更新时间:2023-11-08 10:47:58

我遇到了同样的问题.可能作者修改后忘记测试了.打开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.