Using jQuery, I have successfully implemented code to display an image when clicked by storing the image source into a variable like this:
var imgSrc = $(event.target).attr('src');
I then use this variable to add the image to a div and show it on the webpage:
var newImg = '<div class="gallery"><img src="'+imgSrc+'"></div>';
Now, my goal is to modify the image source slightly by appending "Big" to the file name in order to display a larger version of the same image. For example, changing image.png
to imageBig.png
. Is there a way to achieve this using jQuery?