The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Editable Invoice –including tax to total Re: Editable Invoice –including tax to total


Forget that last post, I should’ve looked at what you were actually using. Sorry about any confusion caused. All you need to do is add a bit to update_total and a small event checker for the checkbox. Below is the code you should actually use:

function update_total() {
var total = 0, tax = 0, taxRate = 0.0575;

price = $(this).html().replace("$","");
if (!isNaN(price)) total += Number(price);
total = roundNumber(total,2);

//will change value of total only if taxbox is checked, otherwise
//it will subtract tax from the total, which defaults to 0
if($('#taxbox:checked')) {
tax = total * taxRate;
total += roundNumber(tax,2);
} else {
total -= tax;


Then, towards the bottom of the script where all the other event handlers are inside the document ready function, put this:


Hopefully that works correctly. You may want to add a box the html to show what the tax is or note the addition of taxes just so anybody else seeing it isn’t confused.