jQuery Swap Image

Glenn Blog Leave a Comment

A simple jQuery snippet to swap the image source / attribute on load:-

jQuery(function($) {
    //caches a jQuery object containing the image element
    var branding = $(".your-class img");
function swapImage() {
          branding.attr('src', '/dir/image.png');
        }
  swapImage();
});
About the Author
jQuery Swap Image jQuery Swap Image 0da77002febbfe28d15144a57bbcc2c9 s 180 d mm r g

Glenn

A highly experienced Web Designer / Web Developer (Webflow, WordPress, Weebly & Custom), Front-end / Back-end Developer & New Media Specialist, with extensive knowledge of a wide spectrum of technologies in the Development and Creative Industries, built up over a number of years.