Answers for "css hide broken image"

1

HIDE BROKEN IMAGES

$('img').on('error', function(){
      $(this).hide();
  });

  /*// OR replace
  ---------------------------*/
  $('img').on('error', function (){
      $(this).attr('src', '/path/to/image/default.png');
  });
Posted by: Guest on February-03-2021

Browse Popular Code Answers by Language