Tagsinput 不是一个函数,使用 bootstrap 3 和 tags-input 插件 [英] Tagsinput is not a function, using bootstrap 3 and tags-input plugin

查看:24
本文介绍了Tagsinput 不是一个函数,使用 bootstrap 3 和 tags-input 插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 jquery 1.10 中使用 bootstrap 3 并且我正在尝试使用标签输入插件(http://timschlechter.github.io/bootstrap-tagsinput/examples/bootstrap3/) 但它不起作用.这是我的错误:

TypeError: tagsinput[arg1] 不是函数var retVal = tagsinput[arg1](arg2);

这是我的 html 代码:

 <script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAv92iA1TcfCnk4-bDg7BAJoKOCnh1g7oQ&sensor=false"></script><link href="/qtip2/css/jquery.qtip.min.css" media="screen" rel="stylesheet" type="text/css" ><link href="/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" ><link href="/css/1309_ciceroos_b2b.css" media="screen" rel="stylesheet" type="text/css" ><link href="/css/1310_longdistance.css" media="screen" rel="stylesheet" type="text/css" ><link href="/bootstrap3.0.0/assets/css/bootstrap-tagsinput.css" media="screen" rel="stylesheet" type="text/css" ><script type="text/javascript"src="/bootstrap3.0.0/assets/js/jquery.js"></script><script type="text/javascript" src="/js/infobox.js"></script><script type="text/javascript" src="/qtip2/js/jquery.qtip.min.js"></script><script type="text/javascript" src="/qtip2/js/imagesloaded.min.js"></script><script type="text/javascript" src="/bootstrap3.0.0/dist/js/bootstrap.min.js"></script><script type="text/javascript" src="/bootstrap3.0.0/assets/js/holder.js"></script><script type="text/javascript" src="/bootstrap3.0.0/assets/js/bootstrap-tagsinput.js"></script><script type="text/javascript">jQuery(document).ready(function ($) {//$('.bootstrap-tagsinput input').attr("value", "interessi");$('#idInputWhat').tagsinput('add', 'mare');$('#idInputWhat').tagsinput('add', 'vino');$('#idInputWhat').tagsinput({最大标签:3});});<身体><form class="form-inline" role="form" id="idFormSearch" method="GET" action="javascript:void(0);"><div class="form-group col-md-offset-1 col-md-5 _interestInput"><input type="text" placeholder="Quali sono le tuepassioni?"data-role="tagsinput" class="form-control input-lg" name="what" id='idInputWhat' value=""/>

<div class="form-group col-md-3 _interestInput"><input type="text" placeholder="dove" class="form-control input-lg" name="where" id='idInputWhere'/><input type="hidden" name="start" id='idStart' value="0"/>

<div class="col-md-3 _searchButton"><input class="btn btn-primary btn-lg" type="submit" value="Ispirami!"></input>

</表单>

请问,有什么建议吗?

解决方案

看起来如果同时指定 data-role="tagsinput" 并使用 $('#idInputWhat').tagsinput('add', 'vino'); 然后它给出了那个错误.尝试删除 data-role 属性,并仅使用显式的 .tagsinput().

我认为这是 tagsinput 插件中的一个错误.

似乎在这里得到证实;https://github.com/TimSchlechter/bootstrap-tagsinput/issues/42

I'm using bootstrap 3 with jquery 1.10 and I'm tring to using tags-input plugin (http://timschlechter.github.io/bootstrap-tagsinput/examples/bootstrap3/) but it doesn't works. This is my error:

TypeError: tagsinput[arg1] is not a function
var retVal = tagsinput[arg1](arg2);

This is my html code:

    <head>

<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyAv92iA1TcfCnk4-bDg7BAJoKOCnh1g7oQ&sensor=false"></script>

<link href="/qtip2/css/jquery.qtip.min.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/css/bootstrap.min.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/css/1309_ciceroos_b2b.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/css/1310_longdistance.css" media="screen" rel="stylesheet" type="text/css" >
<link href="/bootstrap3.0.0/assets/css/bootstrap-tagsinput.css" media="screen" rel="stylesheet" type="text/css" ><script type="text/javascript" src="/bootstrap3.0.0/assets/js/jquery.js"></script>
<script type="text/javascript" src="/js/infobox.js"></script>
<script type="text/javascript" src="/qtip2/js/jquery.qtip.min.js"></script>
<script type="text/javascript" src="/qtip2/js/imagesloaded.min.js"></script>
<script type="text/javascript" src="/bootstrap3.0.0/dist/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/bootstrap3.0.0/assets/js/holder.js"></script>
<script type="text/javascript" src="/bootstrap3.0.0/assets/js/bootstrap-tagsinput.js"></script>
<script type="text/javascript">
                    jQuery(document).ready(function ($) {
                        //$('.bootstrap-tagsinput input').attr("value", "interessi");   
                        $('#idInputWhat').tagsinput('add', 'mare');
                        $('#idInputWhat').tagsinput('add', 'vino'); 

                        $('#idInputWhat').tagsinput({
                            maxTags: 3
                            });                         
                    });
                </script>
        </head>
        <body>
            <form class="form-inline" role="form" id="idFormSearch" method="GET" action="javascript:void(0);">
                                 <div class="form-group col-md-offset-1 col-md-5 _interestInput">
                                    <input type="text" placeholder="Quali sono le tue passioni?" data-role="tagsinput" class="form-control input-lg" name="what" id='idInputWhat' value=""/> 
                                </div>
                                <div class="form-group col-md-3 _interestInput">
                                    <input type="text" placeholder="dove"  class="form-control input-lg" name="where" id='idInputWhere' />
                                    <input type="hidden" name="start" id='idStart' value="0"/> 
                                </div>
                                 <div class="col-md-3 _searchButton">
                                    <input class="btn btn-primary btn-lg" type="submit" value="Ispirami!"></input>
                                  </div>
                              </form>
        </body>

Please, Any suggestions?

解决方案

It looks like if you specify both data-role="tagsinput" and use $('#idInputWhat').tagsinput('add', 'vino'); then it gives that error. Try removing the data-role attribute, and use only the explicit .tagsinput().

I'd consider this a bug in the tagsinput plugin.

Seems to be confirmed here; https://github.com/TimSchlechter/bootstrap-tagsinput/issues/42

这篇关于Tagsinput 不是一个函数,使用 bootstrap 3 和 tags-input 插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆