## Custodial Roth IRA Calculator

Amount to Contribute to Roth Annually

$

Current Age of Child

Number of Years to Contribute

Expected Rate of Return

## Summary

Total ROTH Contributions for Child | |
---|---|

Number of Years to Grow | |

Value at Age 65 (if no further contributions made by child as an adult) |

© Copyright Law Mother 2023

function Calculate() {
let AmounttoContirbute = document.querySelectorAll(".InputClasses")[0].value
let CurrentAge = document.querySelectorAll(".InputClasses")[1].value
let NumberofYears = document.querySelectorAll(".InputClasses")[2].value
let Expectedrate = document.querySelectorAll(".InputClasses")[3].value
if (!AmounttoContirbute || !CurrentAge || !NumberofYears || !Expectedrate) {
return alert("Please fill the all fields")
}
AmounttoContirbute = parseFloat(AmounttoContirbute)
let ROTHContribution = AmounttoContirbute
let TotalROTHContributionsforChild = ROTHContribution * NumberofYears
let NumberofYearstoGrow = 65 - (parseInt(CurrentAge) + parseInt(NumberofYears))
let ValueatLastContribution = FV(Expectedrate / 100, NumberofYears, ROTHContribution)
ValueatLastContribution = Math.abs(ValueatLastContribution)
let ValueatAge65 = FV(Expectedrate / 100, NumberofYearstoGrow, 0, ValueatLastContribution)
ValueatAge65 = Math.abs(ValueatAge65).toFixed(0)
document.querySelectorAll(".OutPutClasses")[0].innerHTML = "$" + parseFloat(TotalROTHContributionsforChild).toLocaleString()
document.querySelectorAll(".OutPutClasses")[1].innerHTML = NumberofYearstoGrow + " years"
document.querySelectorAll(".OutPutClasses")[2].innerHTML = "$" + parseFloat(ValueatAge65).toLocaleString()
}
function FV(rate, nper, pmt, pv, type) {
const pow = Math.pow(1 + rate, nper);
let fv;
pv = pv || 0;
type = type || 0;
if (rate) {
fv = (pmt * (1 + rate * type) * (1 - pow) / rate) - pv * pow;
} else {
fv = -1 * (pv + pmt * nper);
}
return fv;
}
function ShowPopUp(Id) {
var content = `<button type="button" id="close" onclick="ClosePopUp()">×</button>
<h2>Automatic Pop-Up</2>
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Expedita distinctio fugiat alias iure qui, commodi minima magni ullam aliquam dignissimos?
</p>
<a onclick="ClosePopUp()">Close</a>`
let btn2 = `<a onclick="ClosePopUp()">Close</a>`
switch (Id) {
case "AmountPopUP":
content = `
<h2>Amount to Contribute</2>
<div>For tax year 2023 the maximum you can enter in this box is $6,500.</div>
`
break;
case "NoOfYearsPopUP":
content = `
<h2>Number of Years to Contribute</2>
<div>If your child is 11 and you will contribute for them until age 18, put 7 years</div>
`
break;
case "RatePopUP":
content = `
<h2>Expected Rate of Return</2>
<div>Expected Rate of Return (typically 7%)</div>
`
break;
default:
break;
}
document.querySelector(".popup").innerHTML = content + btn2;
OpenPopUp()
}
function OpenPopUp() {
document.querySelector(".popup").style.display = "block";
}
function ClosePopUp() {
document.querySelector(".popup").style.display = "none";
}