Return to Snippet

Revision: 50995
at September 10, 2011 09:44 by chrisaiv


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

Revision: 50994
at September 10, 2011 09:44 by chrisaiv


Initial Code
var img = $(".podcasts").find("img[src='/EI/MS/Images//download.png']");
$(img).attr("src", "/Pics/ArtsAlive/download.png" );

Initial URL

                                

Initial Description
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.

Initial Title
jQuery: Collect img tags based on src then replace them

Initial Tags
jquery

Initial Language
JavaScript