javascript - how to do hedge calculation in jquery on keyup -


please check screenshot more clear

fiddle link

i'm trying program hedging finance formula. did statically, how can dynamically ?

if give amount calculation wants automatically

if give amount "amount - 7000"

++--a--++--b-- 5500  amount- col = 5500 col b(5500) - col a(875) = 4625 col b(4625) - col a(658) = 3967 

this what's happening. how do dynamically in jquery ?

javascript

$(document).ready(function(){     var amountvalue = $('#amountvalue').val();    // var currencybought = $('#currencybought').val();      $('.amountvalue').keyup(function(){      var currencybought =  $('.currencybought122').val();      var finalvalue  = parseint($(this).val())-currencybought;              $('#result345').val(finalvalue);     });  }); 

i use $(".selector").each() loop on inputs

$('[id="result"]').each(function(){             finalvalue -= parseint($(this).val());             $(this).parent().parent().find('.result').val(finalvalue);         }) 

and demo here


Comments

Popular posts from this blog

Email notification in google apps script -

c++ - Difference between pre and post decrement in recursive function argument -

javascript - IE11 incompatibility with jQuery's 'readonly'? -