var image = $('<img src="/images/myimage.png" />'); if (image.attr('width') > 0) imageExists = true; else imageExists = false;
jQuery Check if image exists
There is a quick way to do this without using AJAX to check for a 404.
Snippet Viewed 25958 times.
Share your jQuery code snippets:
- Get some recognition & a link back to your site.
- Create your own code library.
- Help your fellow developers, as they have helped you.