+1 vote
<div class="product-layout-1">
<div class="product-thumb transition">
<div class="image">
<a href="http://m.me/">
<div class="caption">
<a href="http://m.me/" style="height: 44px;">Chat</a>
<div class="cart">
<button>В корзину</button>
$('[href*="path=94"]').attr('href', 'http://m.me/')
There are several such html blocks, where if the link has path=94, I change the attribute to m.me How do I change the .cart block only where the link changes? Tried it, but it changes everywhere there is a .cart block
if ($(".product-thumb a").attr("href", "http://m.me/")) {			        

2 Answers

0 votes
Best answer
$('[href*="path=94"]').each(function() {
.attr('href', 'http://m.me/')
0 votes
Pure js: .innerHTML='текст';
Jquery: .text='текст';

Or use parentheses instead of "=":('текст')
I have a problem that it finds a block with a link m.me/, But it adds a block of html at the end of everything. And you need only where the link changes in the product-thumb a
Code-NaN , read first through the.attr('href') without setting a value. And then update it.