Answers for "js replace broken image"

0

js replace broken image

$(window).bind('load', function() {
  $('img').each(function() {
    if( (typeof this.naturalWidth != "undefined" && this.naturalWidth == 0) 
    ||  this.readyState == 'uninitialized'                                  ) {
        $(this).attr('src', 'missing.jpg');
    }
  });
});
Posted by: Guest on March-04-2022

Code answers related to "Javascript"

Browse Popular Code Answers by Language