diff --git a/README.md b/README.md index 34930b4..26d659b 100644 --- a/README.md +++ b/README.md @@ -282,12 +282,13 @@ So your form will look like this: ### Extra fields -To display the live tax calculation, you can use the classes `vat-subtotal`, `vat-taxes` and `vat-total` on any DOM element and VAT Calculator JS will automatically set the inner HTML content for you. +To display the live tax calculation, you can use the classes `vat-subtotal`, `vat-taxrate`, `vat-taxes` and `vat-total` on any DOM element and VAT Calculator JS will automatically set the inner HTML content for you. Example: ```html Subtotal: € +Tax rate: % Taxes: € Total: € ``` diff --git a/src/public/js/vat_calculator.js b/src/public/js/vat_calculator.js index 04d43e3..6541c50 100644 --- a/src/public/js/vat_calculator.js +++ b/src/public/js/vat_calculator.js @@ -125,6 +125,7 @@ setHTML('total', response.gross_price.toFixed(2)); setHTML('subtotal', response.net_price.toFixed(2)); setHTML('taxes', response.tax_value.toFixed(2)); + setHTML('taxrate', (100*response.tax_rate).toFixed(0)); if (successCallback && typeof(successCallback) === 'function') { successCallback(response); } @@ -231,4 +232,4 @@ } else { window.onload = bindCalculatorEvents; } -}).call(this); \ No newline at end of file +}).call(this);