Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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');
    }
  });
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: js check if value is not empty string 
Javascript :: selectpicker append option 
Javascript :: neo4j delete node by id 
Javascript :: useeffect umnount 
Javascript :: array reverse without mutating 
Javascript :: javascript reference file two folders up 
Javascript :: add element to body javascript 
Javascript :: how to get current year in nodejs 
Javascript :: jmeter mac 
Javascript :: javascript to integer 
Javascript :: display loader on ajax call 
Javascript :: javascript to mask email address 
Javascript :: email validatore regex 
Javascript :: js how to know the laster number of a number 
Javascript :: jquery prop checked 
Javascript :: array to set javascript 
Javascript :: terminate execution in jquery 
Javascript :: node read csv 
Javascript :: material ui icon color 
Javascript :: active menu adminlte 3 using jquery 
Javascript :: how to center a canvas in javascript 
Javascript :: js get local date 
Javascript :: expo update react native 
Javascript :: getelementbyid 
Javascript :: nest js doesnt recognize changes 
Javascript :: input type text js 
Javascript :: foreach element in class javascript 
Javascript :: html-webpack-plugin npm 
Javascript :: javascript screen width 
Javascript :: edit json via nodejs 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =