I need to change the image sources of multiple individual images on a site containing many. They do not have IDs I could use to identify each individual image, which is why I need to make the changes based on the current source each image has.
I have not managed to find a working solution to this.
The html looks like this:
<img class="card-image" alt="" src="www.url.com/12987237857.an-individual-photo.jpg">
Ive found and tried many variations of this but have not found a way to make this change only a specific img src:
$('.card-image').attr('src', $('.card-image').attr('src').replace('original', 'new'));
I have done something similar before with hrefs and this worked perfectly:
$('a[href$="partOfOldURL"]').attr('href', 'newURL');
Could someone help me out? Thank you in advance!