Javascript for calculating processing fees on donation form

Options
Hi Everyone,

I wrote a short and helpful JS and added it to our donation form in Team Raiser. We pay a 5.5% fee on all transactions through TR and wanted to give donors the option to increase their gift in order to cover these fees. If you're interested in doing this, add a Custom HTML section before an Additional Gift line in your donation form. Then add the following code:


/*

You can offset processing fees by giving an additional, 

<h2><div id="increase"></div> <br></h2>

<script>

window.onload = function () {

document.getElementsByName("level_standardname")[0].addEventListener('change', Calculate);


function Calculate(){ 


var g = document.getElementById("level_standardname").value;

var p = .0550;

var i = Math.round(g * p);

document.getElementById("increase").innerHTML = "$" + i;

}

}

</script>

*/


This assumes your form includes an input field for a "Gift Amount." If you're using preset gift amounts, you'll need to adjust the script accordingly. Hope this is helpful for someone out there.
Tagged:

Categories