简体   繁体   中英

jquery event .error doesn't work in IE8

I try to catch event orerror in image.I have code

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

In Google Chrome,Mozilla,IE9 everything ok,but IE8 it doesn't work.Could you help me please!!!

FYI, From the jQuery API docs for 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM