Auto adjust interest rate base on selected terms

Auto adjust interest rate base on selected terms

I have text field where users will input the terms example, (24,12,8) months, and I have text field for rate where the result of terms and given multiplier will show. I want the rate will auto adjusted when I change the terms.

based in given computation.

example only: 24 (months) x 0.02 (given) + 1 (given) = 1.48 (rate)

The problem is I didn't get the correct result on rate field when I change the terms. any ideas?

This is what I've done

  1. <script type="text/javascript">
  2. $(document).ready(function(){
  3.     $(".input").keyup(function(){
  4.       var val8 = +$(".sales_terms").val();
  5.       var percent = 0.02;
  6.       var exempt = 1;
  7.       $("#sales_interestrate").val(Math.round(val8*percent+1));
  8.    });
  9. });
  10. </script>


Help would appreciated. thanks