簡體   English   中英

jQuery事件.error在IE8中不起作用

[英]jquery event .error doesn't work in IE8

我嘗試捕獲圖像中的事件或錯誤。我有代碼

var image = $("#imgBrandDescription img");
var src=image.attr('src');
image.attr("src",src);
image.error(function(){
   $(this).hide();
}

在谷歌瀏覽器,Mozilla,IE9中一切正常,但IE8無法正常工作。請您幫我!

僅供參考,從jQuery API文檔獲取error():

This event may not be correctly fired when the page is served locally. Since error relies
on normal HTTP status codes, it will generally not be triggered if the URL uses the file:
protocol.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM