Broken image detection with jquery


/ Published in: jQuery
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // Replace source
  2. $('img').error(function(){
  3. $(this).attr('src', 'missing.png');
  4. });
  5.  
  6. // Or, hide them
  7. $("img").error(function(){
  8. $(this).hide();
  9. });

URL: http://css-tricks.com/snippets/jquery/better-broken-image-handling/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.