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

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -