How do I calculate using onblur between 3 fields

1

I have 3 fields in a form. Putting the value in one, when leaving this field, lavascript should make the calculation and popular the other two each with a result:

EX:

Campo 1: Entro com o valor 10
Ao sair do campo 1, deve fazer
Campo 2 = Campo1 * 10 / 100
Campo 3 = Campo1 * 20 / 100

How?

    
asked by anonymous 06.01.2017 / 02:10

1 answer

0

With jquery streamline the process ...

$(document).ready(function(){
                $('.input1').blur(function(e){
                    var inp1 = $(this).value;

                    var inp2 = (inp1 * 10)/100;
                    var inp3 = (inp1 * 20)/100;

                    $('.input2').val(desconto);
                    $('.input3').val(total);
                })
            })
    
06.01.2017 / 02:22