Reputation: 83
I am wondering if there is a way to change the last part (name of image) in a URL string using jQuery.
Here is what I have:
http://domain.com/m/m62RLwnqkpPuKl13jSxURBg/80.jpg
and here us what /i need it to be:
http://domain.com/m/m62RLwnqkpPuKl13jSxURBg/140.jpg
Question update:
I need to target and replace the name of the image only, which is "80" in this case, without using the rest of the URL, as the URL path will be different for each image.
<div class="image">
<img alt="" src="http://thumbs3.ebaystatic.com/m/m62RLwnqkpPuKl13jSxURBg/80.jpg" itemprop="image">
</div>
Upvotes: 0
Views: 114
Reputation: 83
OK, I found out the solution. If looking for the same thing, here it is:
$('.image').children().each(function () {
$(this).html(function (i, html) {
return $(this).html().replace(/80.jpg/g, '140.jpg');
});
});
credit goes to @Eliseu Monar
Thank you!
Upvotes: 0