Created
December 8, 2016 08:49
-
-
Save yasircs4/262a816989c7992b677ee4dd9f603777 to your computer and use it in GitHub Desktop.
jQuery when Error Do same things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// @link https://css-tricks.com/snippets/jquery/better-broken-image-handling/ | |
// Replace source | |
$('img').error(function(){ | |
$(this).attr('src', 'missing.png'); | |
}); | |
// Or, hide them | |
$("img").error(function(){ | |
$(this).hide(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment