Умножение с input налету
Как с помощью js (jquery) можно умножать кол-во на сумму налету, и желательно не изменяя структуру HTML:
<span class="price-amount">700<span class="price-symbol">₽</span></span>
<input class="quantity" type="number" value="1" title="Кол-во" inputmode="numeric">
Ответы (1 шт):
Автор решения: Stranger in the Q
→ Ссылка
Может так?
let qty = document.querySelector('.quantity');
let amount = document.querySelector('.price-amount').firstChild;
let price = +amount.textContent;
qty.addEventListener('input', () => amount.textContent = qty.value*price);
<span class="price-amount">700<span class="price-symbol">₽</span></span>
<input class="quantity" type="number" value="1" title="Кол-во" inputmode="numeric">