I am working on a javascript and getting some error. I am using jquery repeater to catch some repeatable products.
$(document).on('keyup', '#discount', function(){
var name = $(this).attr('name');
var loopNo = document.querySelectorAll('.count_list .list_repeat').length;
var i;
var sum = 0;
for(i=0;i<=loopNo;i++){
var selling_price = parseInt(document.getElementsByName("sell_products[".concat(i).concat("][selling_price]"))[0].value);
var quantity = parseInt(document.getElementsByName("sell_products[".concat(i).concat
("][quantity]"))[0].value);
var selling_price_quantity = selling_price * quantity;
sum = sum + (selling_price_quantity - parseInt(document.getElementsByName("sell_products[".concat(i).concat("][discount]"))[0].value));
}
document.getElementById('total_amount').innerHTML = sum; });
This is the code for what I want to get but I am getting Uncaught TypeError: Cannot read property 'value' of undefined this error. I am not able to solve it. Here you can get the full codes. http://ift.tt/2wU2iq6 . Can anyone please help?
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2vHfrnG
via IFTTT
Aucun commentaire:
Enregistrer un commentaire