Guest User

Untitled

a guest
Jul 23rd, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <img id="main" src="missing-image.jpg" />
  2.  
  3. <script type="text/javascript">
  4.  
  5. $(function () {
  6. $("#main").error(function () {
  7. $("#main").attr("src", "generic.jpg");
  8. });
  9. });
  10.  
  11. </script>
  12.  
  13. <img id="mainImage" src="placeholder.jpg" />
  14.  
  15. <script type="text/javascript">
  16. $(document).ready(function() {
  17. $("#mainImage").error(function () {
  18. $(this).attr("src", "generic.jpg");
  19. });
  20. $("#mainImage").attr("src","possibly_missing_image.jpg");
  21. });
  22.  
  23. </script>
  24.  
  25. $(function () {
  26. $("#main").bind('error abort', function () {
  27. $(this).attr("src", "generic.jpg");
  28. });
  29. });
  30.  
  31. $(document).ready(function() {
  32. $("#mainImage").error(function () {
  33. $(this).attr("src", "generic.jpg");
  34. })
  35. .each(function() {
  36. $(this).attr("src",$(this).attr("src"));
  37. });
Add Comment
Please, Sign In to add comment