jQuery Swap Image

Glenn Blog 0 Comments

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 WordPress Web Developer, Front-end and 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.

Leave a Reply

Your email address will not be published. Required fields are marked *