Answer the question
In order to leave comments, you need to log in
How to set a condition (replacing the html block) if the price is 0?
<span class="price"><span class="Price-amount amount">0.00 <span class="Price-currencySymbol">€</span></span></span>
<info></info>
<span class="price"><span class="Price-amount amount">10.50 <span class="Price-currencySymbol">€</span></span></span>
<info></info>
$('.Price-amount').each(function() {
if ($(this).text('0.00')) {
$(this).replaceWith('<div class="info"><img src="/icons8-informaciya-24.png"><div class="info-text">Узнать цену - "какой-то текст"</div></div>');
}
});
Answer the question
In order to leave comments, you need to log in
$('.Price-amount').each(function(index, el) {
if ($(el).text().includes('0.00')) {
$(el).replaceWith('<div class="info"><img src="/icons8-informaciya-24.png"><div class="info-text">Узнать цену - "какой-то текст"</div></div>');
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question