I have a number of urls, and I'm wondering if there's a way to dynamically change the last digit of them.
<div class="m_item">
<a class="thumbnail_link" href="http://paraboladesignstudio.ipage.com/yahaira/fashion/fashion-slideshow/?thumb=0">
<img src="<?php echo $image['sizes']['thumbnail'];?>" title="<?php echo $image['title'];?>" alt="<?php echo $image['alt']; ?>">
</a>
</div>
The above code outputs certain number of ".m_item"s with the same "a href"s.
This is my jQuery code:
var i=0;
i++;
$(".thumbnail_link").each(function() {
this.href = this.href.replace("0", i);
});
It changed all the urls to "..../?thumb=1"
How could I make the digit increase? I've tried .children with no luck.
Thank you.
$(".thumbnail_link").each(function(i) { this.href = this.href.replace("0", i); });and remove yourideclaration