javascript - 使用 JQuery 的 IE 中的堆栈溢出(第 12/1076 行)

标签 javascript jquery stack-overflow

我正在使用来自 Google CDN 的 JQuery,并且在第 12 行(对于最小文件)和第 1076 行(对于未压缩文件)出现堆栈溢出错误(使用 IE8)。堆栈溢出错误将我带到的行的 JQuery 代码是:

JQuery.js ...

makeArray: function( array ) {
    var ret = [];

    if( array != null ){
        var i = array.length;
        // The window, strings (and functions) also have 'length'
        // @ALL : this is the line i am getting error on ...
        if( i == null || typeof array === "string" || jQuery.isFunction(array) || array.setInterval )
            ret[0] = array;
        else
            while( i )
                ret[--i] = array[i];
    }

    return ret;
},

...

这是我的代码: ...

  $(document).ready(function(){
    $("#newcmpgn").validate({ 
      errorElement:'dt', 
      rules:{agree: "required"},
      messages:{agree: "You need to accept to Terms and Conditions in order to continue."}
    });
    $("#newcmpgn").submit(function(){
      if($("#newcmpgn").valid()){
        var ubal = Number($("#userbalance").val());
        var camt = Number($("#amount").val());
        if(ubal > camt){
          $("#newcmpgn").attr('action', '<?= site_url('account/payments/actpayment/'.$cmpgn_id) ?>');
          return true;
        }
        if($("#autorenew").attr('value') == 'Y'){
          $("#newcmpgn").attr('action', '<?= site_url('account/payments/makepayment/'.$cmpgn_id) ?>');
        }else{
          $("#newcmpgn").attr('action', '<?= site_url('account/payments/makesinglepayment/'.$cmpgn_id) ?>');
        }
        $("#newcmpgn").submit();
        return true;
      }
      return false;
    });
  });

提交表单时出现错误。我在这里看不到任何会让 IE8 开始提示堆栈溢出的递归代码?

谢谢, 深度。

最佳答案

您正在提交函数内调用 $("#newcmpgn").submit();

这对我来说看起来是递归的!

关于javascript - 使用 JQuery 的 IE 中的堆栈溢出(第 12/1076 行),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1768855/

相关文章:

JavaScript:触发多个事件?

javascript - 在 Jquery 中动态创建的输入值的乘法和求和

windows - 我不明白调用堆栈中重复 DispatchMessageW 的堆栈溢出错误

python - 如何增加 Python 中的最大递归深度?

javascript - 未看到全局 JS var

javascript - FormData 不包含按钮的值

javascript - 如何避免reactjs索引中的复杂层次结构

jquery - free-jqgrid:setCell 将 css 类添加到单元格

javascript - 悬停时CSS使图像变暗-在其周围添加一个href

java - 实例化对象时出现 StackOverFlow 错误