I am working with wordpress,I want to change "url"(product link) of "product-image" in "cart" page,
So i have following code (dynamic)
<td class="product-name" data-title="Product">
<a href="abc.com/en/product/basic-c-organic/">Basic-C-Organic</a>
</td>
How can i change the url of this product with jquery,I tried with following code but not working,how can i do this ?
var product = $('.product-name').next("a").text();
2
Answers
You need to "find" the the a tag and the change the link with the .attr() of jquery
You can do it like below:
Running example:
Note: Now based on the product name (link text), the link URL will change dynamically once the page is loaded.