You want to calculate the amount incl vat. Two fields: amount w.o. vat and vat percentage
Create an onblur event on amount w.o. vat to calculate amount incl. vat (php method)
Create an onchange event on tax perc. to calculate amount incl. vat (php method)
Test the application and it works well.
Now create a calcuator box behind the amount w.o. vat.
Test the application.
If you use the calculator and click ‘use’ then the field is filled with the amount in the calculator.
But: the focus on the field is lost
click tab and the focus is somewhere else so the event onblur does not trigger.
Using onchange on the amount w.o. vat is not conveniant as it will recalculate on every keystroke you make.