jquery - 未捕获的类型错误 : ((x. event.special[i.origType] || (中间值)).handle || i.handler).apply 不是函数

标签 jquery asp.net-mvc

请帮助我。当我在 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 })

This is an image of the error

最佳答案

在我的例子中,错误是由于将事件绑定(bind)到不存在的函数而引起的。我删除了我不知道与事件绑定(bind)的函数。

请参阅下面的代码片段:

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

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

// Not Working because bar2 doesn't exist
$('body').on('click', '.my-button', 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

关于jquery - 未捕获的类型错误 : ((x. event.special[i.origType] || (中间值)).handle || i.handler).apply 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32231036/

相关文章:

javascript - jQuery 拖放插件不会将元素从其位置移动 - 只是制作副本?

javascript - 无法将 div 准确定位在另一个元素上

javascript - 单击多个按钮时更改 div 的宽度

javascript - 使用 AJAX 从 JSP 页面调用 Action 类

asp.net-mvc - MVC 3 项目结构

c# - ASP.NET MVC 属性路由和本地化

javascript - 谷歌地图 - 如何更改谷歌地图信息窗口文本

asp.net-mvc - Mono 上的 ASP.NET MVC

asp.net-mvc - MVC 使用 SimpleMembership 检索用户名

javascript - 调试 Javascript 挂起系统