I've a script calculates my dynimic buy form. Everything works fine but when I add quantity input script takes only first value. I want to it takes every next value from "value" (each). I will be glad for help.
$(function() {
$("#sumuj").click(function() {
var add = 0;
var add2 = 0;
$(".netto").each(function() {add += Number($(this).val()) * $(".value").val();});
$(".brutto").each(function() {add2 += Number($(this).val()) * $(".value").val();});
add = add.toFixed(2);
add2 = add2.toFixed(2);
$("#price").val(add);
$("#pricevat").val(add2);
});
});
Done:
$(function() {
$("#sumuj").click(function() {
var add = 0;
var add2 = 0;
$(".netto").each(function() {add += Number($(this).val()) * Number($(this).parent().find('.value').val());});
$(".brutto").each(function() {add += Number($(this).val()) * Number($(this).parent().find('.value').val());});
add = add.toFixed(2);
add2 = add2.toFixed(2);
$("#price").val(add);
$("#pricevat").val(add2);
});
});
Thx for help/