How check if file (image) exists in javascript using jquery
img = 'someimage.jpg'
$('<img>').attr('src',img);
How check if file (image) exists in javascript using jquery
img = 'someimage.jpg'
$('<img>').attr('src',img);
Attach an onerror event listener to that image.
img.onerror = function(){ alert("not found"); }
or use get request
$.get('someimage.jpg', function(data){
}).fail(function() {
alert('not found');
});