Tuesday, May 22, 2012

SharePoint 2010 / jQuery - Swapping Images

Web part uploaded and forgot to include the image in the feature? This could be a potential issue on a managed SharePoint 2010 environment (Office 365 - Dedicated, etc.). The reference points to a path in the _layouts folder. How can I temporarily resolve this issue until I update the project?

Simple. Modify the master page or add a content editor web part with the following jQuery, and store the image into a location that is easily accessible.
  jQuery(function()
  {
    jQuery('img[src="/_layouts/images/old-image.png"]')
      .attr("src", "/subsite/PublishingImages/new-image.gif");
  });
Post a Comment