Skip to content

Instantly share code, notes, and snippets.

@gerbenvandijk
Created September 27, 2013 10:26
Show Gist options
  • Save gerbenvandijk/6726644 to your computer and use it in GitHub Desktop.
Save gerbenvandijk/6726644 to your computer and use it in GitHub Desktop.
Check for a valid image in HREF.
function IsValidImageUrl(url, callback) {
jQuery("<img>", {
src: url,
error: function() { callback(false); },
load: function() { callback(true); }
});
}
// usage
IsValidImageUrl(url, function(result) {
//action
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment