<div class="mt-repeater-item">
<div class="row mt-repeater-row">
<input type="text" name="product[0][price]" value="2" oninput="update_total(this)">
</div>
</div>
<div class="mt-repeater-item">
<div class="row mt-repeater-row">
<input type="text" name="product[1][price]" value="3" oninput="update_total(this)">
</div>
</div>
Und mein SkriptFehler nicht erfasste Fehler: Syntaxfehler, nicht erkannte Äußerung
function update_total(input) {
var sum = 0;
$('.mt-repeater-item').each(function(index) {
var product_price = $("input[name=product["+index+"][price]]").val() ? $("input[name=product["+index+"][price]]").val() : 0;
sum = sum + product_price;
});
alert(sum);
}
Error Uncaught Error: Syntax error, unrecognized expression
=> Wie es zu beheben?
auch verwenden 'parseInt'. Summe = Summe + ParseInt (Produktpreis); – Gowri
@Gowri Der Code wurde geändert –