GVKun编程网logo

jQuery Bootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)

140

本文将带您了解关于jQueryBootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)的新内容,另外,我

本文将带您了解关于jQuery Bootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)的新内容,另外,我们还将为您提供关于android – TypeError:undefined不是函数(评估’remoteModules.forEach’)、bootstrap datepicker Uncaught TypeError: Cannot call method''split'' of undefined 问题、Bootstrap Modal with Rails 6上的Jquery、Bootstrap Modal中的jQuery验证不起作用的实用信息。

本文目录一览:

jQuery Bootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)

jQuery Bootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)

在我的应用程序中,我想在ajax请求完成后手动关闭引导模式视图.
我叫jQuery(‘#myModal’).modal(‘hide’);在回调中,

function(){                                       
   jQuery('#myModal').modal('hide');
}

但模态视图不会被隐藏.我仔细检查了我在Bootstrap之前包含jQuery,所以问题不在那里.

我总是得到以下错误:

TypeError: 'undefined' is not a function (evaluating 'jQuery('#myModal').modal('hide')')

模态看起来像这样:

<!-- Modal -->
<div aria-hidden="false" aria-labelledby="modalinviteFlatmateLabel" role="dialog" tabindex="-1"id="myModal">
    <form id="add-flatmate-form" action="/flatmates/show" method="post">    
    <div>
        <button aria-hidden="true" data-dismiss="modal"type="button">&times;</button>
        <h3 id="modalinviteFlatmateLabel">Invite Flatmate</h3>
    </div>
    <div>
        <p>
            Enter the mail address of your flatmate you want to invite.
        </p><br />
        <input placeholder="E-Mail"name="AddFlatmateForm[email]" id="AddFlatmateForm_email" type="text" />    </div>
    <div>
        <inputtype="submit" name="yt0" value="Invite" id="yt0" />        <!--<button>Invite</button>-->
    </div>
    </form>
</div><!--#myModal-->

附加信息:

> jQuery版本:1.9.1,
> Bootstrap版本:2.3.2

有任何想法吗?

解决方法

现在已经晚了,但我希望这会有所帮助.
确保在自定义脚本之前包含jQuery库,并且Firebug的Net选项卡中没有错误(确保jQuery实际上已加载).
在firebug中测试你的javascript代码,当准备添加到你的实际代码时,你可以把它称为anounymous函数:

(function ($) {
   $(document).ready(function(){
     //your code
     ('# id of the modal element to close ').modal('hide')
   });
//your code
}(jQuery));

您可以查看此视频link to tutorial,我认为他们已经很好地公开了调试过程.

android – TypeError:undefined不是函数(评估’remoteModules.forEach’)

android – TypeError:undefined不是函数(评估’remoteModules.forEach’)

我正在尝试测试这个应用程序:
https://github.com/7kfpun/FinanceReactNative

我使用react-native:0.26.3

当应用程序启动时,我会自动获得一个

TypeError: undefined is not a function (evaluation ''remoteModules.forEach'')

这是我第一次尝试使用react-native而我不知道如何才能解决这个问题:/

enter image description here

解决方法

我也遇到了类似的问题.
我的建议是尝试删除node_modules并再次安装所有内容.
它解决了我的问题.希望它也会有所帮助.

我从下面得到了这个解决方案.
https://github.com/xotahal/react-native-material-ui/issues/26

bootstrap datepicker Uncaught TypeError: Cannot call method''split'' of undefined 问题

bootstrap datepicker Uncaught TypeError: Cannot call method''split'' of undefined 问题

这个问题主要是由于 date 对象不是字符串,不能使用 split 函数,简单处理一下,转换成字符串就可以解决问题:

++++++++++++++++++++++++
parseDate: function(date, format) {
var parts = date.split(format.separator), <=== 出错的地方
++++++++++++++++++++++++

改成:

++++++++++++++++++++++++
parseDate: function(date, format) {
date = date + ""; <==== 加上这一行
var parts = date.split(format.separator),
++++++++++++++++++++++++

 

Bootstrap Modal with Rails 6上的Jquery

您需要为每个模态处理唯一性。

尝试一下:

<%= link_to 'Add',shopifyproduct,{:remote => true,'data-toggle' =>  "modal",'data-target' =>
         '#exampleModal-<%= shopifyproduct.id %>',class: 'btn btn-primary btn-lg'}  %>

,每个shopify产品都应具有自己的模式:

<% @shopifyproducts.each do |shopifyproduct| %>
<!-- Modal -->
<divid="exampleModal-<%= shopifyproduct.id %>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <divrole="document">
    <div>
      <div>
        <h5id="exampleModalLabel">Modal title</h5>
        <button type="button"data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div>
        <%= shopifyproduct.title %>
      </div>
      <div>
        <button type="button"data-dismiss="modal">Close</button>
        <button type="button">Save changes</button>
      </div>
    </div>
  </div>
</div>
<% end %>

Bootstrap Modal中的jQuery验证不起作用

Bootstrap Modal中的jQuery验证不起作用

将jQuery验证应用于Modal引导程序它没有任何效果,检查所有包含的库及其顺序,并注意到它们是正确的.

> Bootstrap:版本3.3.1
> jQuery:版本1.11.1
> jQuery-validate:版本1.13.1

主编:

<head>
    <title>Titulo</title>

    <link rel="stylesheet" type="text/css" href="../CSS/StyleSheet.css"/>
    <script type="text/javascript" src="../Bootstrap/js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="../Bootstrap/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../datepicker/js/bootstrap-datepicker.js"></script>
    <script type="text/javascript" src="../Jquery-Validate/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../Javascript/Actionjs.js"></script>

    <link rel="stylesheet" type="text/css" href="../Bootstrap/css/bootstrap.min.css" media="screen" />
    <link rel="stylesheet" type="text/css" href="../datepicker/css/datepicker.css" media="screen" />

    <Meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <Meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
</head>

模态代码(在没有AJAX的情况下加载它的HTML)

<divid="login_modal" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
        <div>
            <div>
                <formid="login-form" action="../PHP/ValidateForm.PHP" method="get">
                    <div>
                        <button type="button"data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4id="myModalLabel"><span>Login</span></h4>
                    </div>
                    <div>
                        <div>
                            <div>
                                <label for="input_email">Your Email (login)</label>
                                <div>
                                    <input type="email"id="email" name="email" placeholder="Email">
                                </div>
                            </div>
                            <div>
                                <label for="input_password">Password</label>
                                <div>
                                    <input type="password"id="pass" name="pass" placeholder="Password">
                                </div>
                            </div>
                            <divhttps://www.jb51.cc/tag/Box/" target="_blank">Box text-center">
                                <label><input type="checkBox" id="remember_me" name="remember_me">Remember me on this computer</label>
                            </div>
                        </div>
                        <div>
                            <div>
                                <button type="reset">Reset</button>
                            </div>
                        </div>
                    </div>
                    <div>
                        <button type="button"data-dismiss="modal">Close</button>
                        <button type="submit"name="login_form_submit" value="Login">Login</button>
                    </div>
                </form>
            </div>
        </div>
    </div>

将标签更改为模态体提交按钮不起作用,并且在此视频中检查它将是正确的位置.

Actionjs代码(验证文件)

$(document).ready(function(){
     $("#login-form").validate({
    rules:{
        name:{
            required:true,minLength:8
        },pass:"required"
    },messages:{
        name:{
            required:"Please provide your Login",minLength:"Your Login must be at least 8 characters"
        },pass:"Please provide your password"
    }
});

});

解决方法

你的代码有两个问题……

rules:{
    name:{  // <- no such element
        required:true,minLength:8  // <- no such rule
    },pass:"required"
},

>你没有name =“name”的输入元素.也许你的意思是邮件.
>没有这样的规则叫minLength.我想你的意思是minlength.

注意:您的消息选项中也存在上述相同的两个问题.

工作演说:http://jsfiddle.net/nk3j4mtu/

今天关于jQuery Bootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)的讲解已经结束,谢谢您的阅读,如果想了解更多关于android – TypeError:undefined不是函数(评估’remoteModules.forEach’)、bootstrap datepicker Uncaught TypeError: Cannot call method''split'' of undefined 问题、Bootstrap Modal with Rails 6上的Jquery、Bootstrap Modal中的jQuery验证不起作用的相关知识,请在本站搜索。

本文标签: