[Solved] jQuery – update variable when input values changed
With a few tweaks to the JS and HTML, the following code works… $(‘body’).on(‘keyup’, ‘.qty_field’, function () { var sum = 0; $(‘.qty_field’).each(function() { sum += Number($(this).val()); }); $(‘.running_total’).html(sum); }); solved jQuery – update variable when input values changed