As per my screenshot here: https://drive.google.com/file/d/1N3ozAMXjbpyjmMNIE7xk6kOvZRB58Koy/view
Muy first row of extras items and options are working fine, I created these functions with a PHP variable/counter.
So, I intend to do the to do the same with Jquery and a counter when I clone new rows of extras and options as show with the red arrows, but does not work.
Please, see the file running here: https://quotations.casalindacity.com/newquotation.php
//START CACULATION AUTOMATIC FOR OPCIONS ITEMS WITH JQUERY
for (var c = 1; c < opcionescant; c++) {
alert(c);
$('#priceoptc'+c).keyup(function () {
//calculate the total amount of this option
var amountextra = 0;
amountextra =((Number($('#priceoptc'+c).val()))*(Number($('#qtyoptc'+c).val())));
$('#totaloptc'+c).val(amountextra);
});
$('#qtyoptc'+c).keyup(function () {
//calculate the total amount of this option
var amountextra = 0;
amountextra =((Number($('#priceoptc'+c).val()))*(Number($('#qtyoptc'+c).val())));
$('#totaloptc'+c).val(amountextra);
});
}
//END CACULATION AUTOMATIC FOR OPCIONS ITEMS WITH JQUERY
I have tried this:
$("#addRow10").click(function(){
opcionescant++;
//$("#options").clone().appendTo("#tableqtn");
var optrow = $("#options").clone(true,true);
//fixIds(optrow, opcionescant);//add this counter to the current id as a string
fixIds2(optrow, opcionescant);//add this counter to the current id and replace with current number
optrow.appendTo("#tableqtn");
//alert(opcionescant);
$('#priceoptc'+opcionescant).keyup(function () {
//calculate the total amount of this option
var amountextra = 0;
amountextra =((Number($('#priceoptc'+opcionescant).val()))*(Number($('#qtyoptc'+opcionescant).val())));
$('#totaloptc'+opcionescant).val(amountextra);
});
$('#qtyoptc'+opcionescant).keyup(function () {
//calculate the total amount of this option
var amountextra = 0;
amountextra =((Number($('#priceoptc'+opcionescant).val()))*(Number($('#qtyoptc'+opcionescant).val())));
$('#totaloptc'+opcionescant).val(amountextra);
});
});
And work but only in the current cloned row, so when a new row is cloned the previous one does not work.