jQuery:未捕获的TypeError:$(...).error不是函数 [英] jquery: Uncaught TypeError: $(...).error is not a function

查看:149
本文介绍了jQuery:未捕获的TypeError:$(...).error不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在页面上使用了jQuery,其他部分没有问题.甚至$ .post和$ .get都可以正常工作.

I am using jquery on my page and don't have problem with other parts. Even $.post and $.get are working fine.

现在,我正在尝试评估图像是否有任何问题,并尝试了以下代码:

Now I am trying to evaluate if an image has any problems and tried this code:

$("#bib").error(function(){
   //nothing now 
});

我想知道为什么会出现此错误:

I am wondering why I get this error:

Uncaught TypeError: $(...).error is not a function
at app.js:53
(anonymous) @ app.js:53

如您所见,我已经简化了代码以隔离问题,但您了解了整个想法.目前,这些jquery源包含在页面内:

As you see I have shortened the code to isolate the problem but you get the whole idea. At the moment these jquery sources are included inside the page:

https://code.jquery.com/jquery-3.1 .0.min.js https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js

https://code.jquery.com/jquery-3.1.0.min.js https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js

知道为什么会这样吗?

推荐答案

请改用它(如前所述,.error已被删除).

Use this instead (as stated earlier, .error has been removed).

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script>

$("#bib").on('error', function(){
   //nothing now 
});

</script>

这篇关于jQuery:未捕获的TypeError:$(...).error不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆