Показать сообщение отдельно
  #7 (permalink)  
Старый 07.12.2019, 23:34
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,121

svileff,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  </style>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

  <script>
$(function() {
function numberWithCommas(str) {
    return (+str).toFixed(0).replace(/(\d+)(\.\d+)?/g, function (c, b, a) {
    return b.replace(/(\d)(?=(\d{3})+$)/g, "$1 ") + (a || "")
});
}

$(".t706__product-amount.t-descr.t-descr_sm").each(function(i, el) {
var num = (el.textContent.replace(/[^0-9.]/g, "") || 0) * 0.8;
var txt = numberWithCommas(num);
$(el).after(`<div class="t706__product-amount-sale">${txt}&nbsp;р.</div>`)
})
});
  </script>
</head>

<body>
<div class="t706__cartwin-products">
<div class="t706__product" data-cart-product-i="0">
<div class="t706__product-thumb">
<div class="t706__product-imgdiv" style="background-image:url(https://static.tildacdn.com/tild3632-3963-4232-b737-393335343436/903417_S.jpg);">
</div>
</div>
<div class="t706__product-title t-descr t-descr_sm">Elizavecca Milky Piggy Hell-Pore Longolongo Gronique Gold Mask Pack<div style="opacity:0.7;font-size:12px;font-weight:400;">903417</div>
</div>
<div class="t706__product-plusminus t-descr t-descr_sm">
<span class="t706__product-minus">
<img src="https://static.tildacdn.com/lib/linea/c8eecd27-9482-6c4f-7896-3eb09f6a1091/arrows_circle_minus.svg" style="width:16px;height:16px;border:0;"></span>
<span class="t706__product-quantity">3</span><span class="t706__product-plus"><img src="https://static.tildacdn.com/lib/linea/c47d1e0c-6880-dc39-ae34-521197f7fba7/arrows_circle_plus.svg" style="width:16px;height:16px;border:0;"></span>
</div>
<div class="t706__product-amount t-descr t-descr_sm">3 861&nbsp;р.</div>
<div class="t706__product-del"><img src="https://static.tildacdn.com/lib/linea/1bec3cd7-e9d1-2879-5880-19b597ef9f1a/arrows_circle_remove.svg" style="width:20px;height:20px;border:0;">
</div>
</div>

<div class="t706__product" data-cart-product-i="1">
<div class="t706__product-thumb">
<div class="t706__product-imgdiv" style="background-image:url(https://static.tildacdn.com/tild6130-6561-4633-a631-306663633061/904117_S.jpg);">
</div>
</div>
<div class="t706__product-title t-descr t-descr_sm">Elizavecca Milky Piggy Vitamin C 21% Ample Mask<div style="opacity:0.7;font-size:12px;font-weight:400;">904117</div>
</div>
<div class="t706__product-plusminus t-descr t-descr_sm"><span class="t706__product-minus"><img src="https://static.tildacdn.com/lib/linea/c8eecd27-9482-6c4f-7896-3eb09f6a1091/arrows_circle_minus.svg" style="width:16px;height:16px;border:0;"></span><span class="t706__product-quantity">1</span><span class="t706__product-plus"><img src="https://static.tildacdn.com/lib/linea/c47d1e0c-6880-dc39-ae34-521197f7fba7/arrows_circle_plus.svg" style="width:16px;height:16px;border:0;"></span>
</div>
<div class="t706__product-amount t-descr t-descr_sm">1 320&nbsp;р.</div>
<div class="t706__product-del"><img src="https://static.tildacdn.com/lib/linea/1bec3cd7-e9d1-2879-5880-19b597ef9f1a/arrows_circle_remove.svg" style="width:20px;height:20px;border:0;">
</div>
</div>
</div>
</body>
</html>
Ответить с цитированием