Skip to content Skip to sidebar Skip to footer

Get Result Of A Multiplication Of Two Input Tags Into A Different One

I have two inputs tags. one is quantity and the other is rate. How can I show the result of the multiplication of those directly into a different input tag straight after the user

Solution 1:

Maybe this helps a little bit.... (Dirty... i know)

<inputid="in1"><inputid="in2"><inputid="in3"><script>var val1=0;
 var val2=0;
 var val3=0;
 $(document).ready(function(){
   $('#in1').keyup(function(){
     val1=$(this).val();
     val2=$('#in2').val();
     val3=parseInt(val1)*parseInt(val2);
     $('#in3').val(val3);
   });
   $('#in2').keyup(function(){
     val2=$(this).val();
     val1=$('#in1').val();
     val3=parseInt(val1)*parseInt(val2);
     $('#in3').val(val3);
   });
 });
</script>

NOT TESTED

Post a Comment for "Get Result Of A Multiplication Of Two Input Tags Into A Different One"