Posted By

chrisaiv on 09/10/11



Versions (?)

jQuery: Collect img tags based on src then replace them

 / Published in: JavaScript

This two liner is powerful. It shows you how to find images on a page based on the source (src) and replace them with another image.

  1. var img = $(".columnLeft").find("img[src='/path/to/existing/image/file.png']");
  2. $(img).attr("src", "/path/to/new/image/file.png" );

Report this snippet  

You need to login to post a comment.