我的页面上有多个图像.为了检测损坏的图像,我在SO上使用了这个.
$('.imgRot').one('error',function(){
$(this).attr('src','broken.png');
});
Run Code Online (Sandbox Code Playgroud)
这在我理解的第一张图片上工作正常.但是当我改变它
$('.imgRot').on('error',function(){
$(this).attr('src','broken.png');
});
Run Code Online (Sandbox Code Playgroud)
它不适用于任何图像.有人能告诉我为什么吗?
jquery ×1