JSFiddle - React, Tailwind, and code Playground
by TheFiddler
HTML
<a href="#" class="product-link" rel="178" alt="Preview Product Image" title="Preview Product Image">
<img longdesc="dynamicfolder/61CA7667851C/thumbnail.jpg" src="http://placehold.it/150x150" class="Store178" id="ctl00_mainBody_rptMain_ctl00_imgAsset" />
</a>
JavaScript
function CreateUpdatedURL(){
console.log("Magic is happening");
return "http://placehold.it/300x300/";
}
function createImageUrls()
{
$('.product-link > img').each(function (index)
{
var imagepath = $(this).attr('longdesc');
alert('Longdesc: ' + imagepath);
var pid = $(this).prop('class');
var imageSource = CreateUpdatedURL() + imagepath;
var classname = "." + pid;
//set src based on new dynamic path
$(classname).prop('src', imageSource);
});
}
$(document).ready(function(){
createImageUrls()
});