jquery – 未捕获的TypeError:((x.event.special [i.origType] ||(中间值)).handle || i.handler).apply不是函数

前端之家收集整理的这篇文章主要介绍了jquery – 未捕获的TypeError:((x.event.special [i.origType] ||(中间值)).handle || i.handler).apply不是函数前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
请帮帮我.当我在ASP.NET MVC中使用jQuery时,这是一个错误.

Uncaught TypeError: ((x.event.special[i.origType] || (intermediate
value)).handle || i.handler).apply is not a function Uncaught
TypeError: ((x.event.special[i.origType] || (intermediate
value)).handle || i.handler).apply is not a function

导致这种情况的代码是:

$('#btnClick').click(function(){   //code })

解决方法

在我的情况下,错误是由绑定事件到不存在的函数引起的.我删除了我不知道的事件.

请参阅下面的代码段:

var foo = {
  bar1: function(){
    alert('working');
  }
};

// Working
$('body').on('click','.my-button',foo.bar1);

// Not Working because bar2 doesn't exist
$('body').on('click',foo.bar2);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<span class="my-button">Click me</span>

它会产生:

Uncaught TypeError: ((n.event.special[g.origType] || (intermediate value)).handle || g.handler).apply is not a function

原文链接:https://www.f2er.com/jquery/180798.html

猜你在找的jQuery相关文章