Calculate fields

Good morning everyone.
I’m going crazy because I can’t get multiplying two values of a row in a table to work. See code below:
I also watched the youtube tutorial but still couldn’t get the code to work.
Could someone kindly tell me where I’m wrong? I’m not a programmer and know very little javascript. It would be nice if there was a section with code examples to be adapted for every need (addition, multiplication etc etc)
Thanks again

$('#ctrl-Pesonetto').on('input',function(){ 

var $Pesonetto = $(this).closest('form').find('#ctrl-Pesonetto').val();
var $Prezzo = $(this).closest('form').find('#ctrl-Prezzo').val();
var $Tot1 = $(this).closest('form').find('#ctrl-Tot').val();

$Tot = ($Pesonetto * $Prezzo);
$Tot1.val=($Tot);
});

1 Like