Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 9th, 2012  |  syntax: None  |  size: 0.35 KB  |  hits: 19  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Onclick Replace Image w/ jQuery
  2. $("img.thumbnail").click(function() {
  3.     var $this = $(this);
  4.     var imgToLeft = $this.prev("img");
  5.     $this.attr("src", imgToLeft.attr(src));
  6. });
  7.        
  8. $(document).on("click", "img.thumbnail", function() {
  9.     var $this = $(this);
  10.     var imgToLeft = $this.prev("img");
  11.     $this.attr("src", imgToLeft.attr(src));
  12. });