img onerror


The onerror event is triggered if an error occurs when loading an image.

<div id="testDiv"></div>

function setNoneImg(){

  $('#testDiv img').each(function(i){
    $('#testDiv img')[i].onerror=function(){
        $($('#testDiv img')[i]).attr('src',"error.jpg");
      }
    }
  );
 
}

 w3 schools.com/jsref/event_img_onerror.asp

评论

此博客中的热门博文

XML, XSL, HTML

Input in element.eleme.io

Data URI是由RFC 2397 ACE