How and what better way to calculate a net value [closed]

-5

These days I came across a problem that I can not solve and I do not know much where it starts.

I have these 4 fields in my system, where, if the user infuses the percentage discount, the system automatically shows to the user, in the field Discount in R $, amount that I get in cash, and if the user reports in the field Discount in R $, it shows in the Discount% field, percentage value and vice versa, being something dynamic, and at the end of it all, show Total Liquid, but that's the least, I just want something dynamic, with the 2 fields Discount% and Discount R $, where in the field that the user informs it shows either the percentage or the cash discount.

If someone gives me a light where to start, to do it dynamically, I know that I will have to use script but I do not know where it starts.

Thanks in advance!

    
asked by anonymous 01.09.2017 / 22:39

1 answer

-1

Well, to appear automatically you can use an html event like onkeypress I think.

Now, to calculate % and R$ fault% you can give a name to the input and with jQuery when the html event is activated check if the name corresponds to one of them, function to do the calculations of each one.

At least, that's what I would do.

    
01.09.2017 / 22:43