Home > Software design >  Images with missing src
Images with missing src

Time:11-03

I want to make if statement where I check every image if it has missing src ( not empty but missing ) and if this case is true to add it with some path in it.

CodePudding user response:

let path = '/img.png';

$('img').each(function(){
   if($(this).attr('src') === undefined){
    $(this).attr('src',path);
   }
})
  • Related