admin管理员组文章数量:1400477
I've searched alot to find the answer, but on every page or every question the problem is either the Person didnt include the jQuery files proberly or they were naming something wrong. I tried to use different jQuery CDNs, but obviously the same error came. I even deleted my whole script to look if there is a conflict with the code. Strange thing is, only the .error() handler gets this error. Every other handler works fine. If i call .error() on an other element, it spits out the same error.
HTML:
<img class="prev_img" src="img/no_image.png" alt="Vorschau Bild" width="250px" height="160px">
JS
<script
src=".4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function(){
$("img").error(function(){
console.log("Error");
});
});
</script>
I really don't know what the Problem could be. I restarted my XAMPP multiple times in Hope its messing something up with the file inclution. But it seems that everything works fine.
I'm glad if i could get some help.
Greetings
EDIT:
I've tried using
$(document).ready(function(){
$("img").on("error", function(){
console.log("Error");
});
});
but even though in the console i get a GET
404 not found error, the error handler doesnt do anything.
I've searched alot to find the answer, but on every page or every question the problem is either the Person didnt include the jQuery files proberly or they were naming something wrong. I tried to use different jQuery CDNs, but obviously the same error came. I even deleted my whole script to look if there is a conflict with the code. Strange thing is, only the .error() handler gets this error. Every other handler works fine. If i call .error() on an other element, it spits out the same error.
HTML:
<img class="prev_img" src="img/no_image.png" alt="Vorschau Bild" width="250px" height="160px">
JS
<script
src="https://code.jquery./jquery-3.4.1.min.js"
integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo="
crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function(){
$("img").error(function(){
console.log("Error");
});
});
</script>
I really don't know what the Problem could be. I restarted my XAMPP multiple times in Hope its messing something up with the file inclution. But it seems that everything works fine.
I'm glad if i could get some help.
Greetings
EDIT:
I've tried using
$(document).ready(function(){
$("img").on("error", function(){
console.log("Error");
});
});
but even though in the console i get a GET
404 not found error, the error handler doesnt do anything.
1 Answer
Reset to default 6Per the documentation, .error()
was deprecated in 1.8 and removed in 3.0.
Use .on("error", function() { ... })
instead.
$("img").on("error", function() {
console.log("Error");
});
<script src="https://cdnjs.cloudflare./ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<img src="">
本文标签:
版权声明:本文标题:javascript - jQuery.Deferred exception: $(...).error is not a function, TypeError $(...).error is not a function - Stack Overflo 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744238775a2596686.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论