| <html> |
| <body> |
| Select your filing status:<br> |
| <form> |
| <input type="radio" name="filingStatus" value=0 checked="true"> |
| single<br> |
| <input type="radio" name="filingStatus" value=1> |
| married<br> |
| <input type="radio" name="filingStatus" value=2> |
| head of household<br> |
| </form> |
| Enter your 2019 income here: <input type="text" id="incomeInput"> |
| <br> |
| Enter the number of your dependents below the age of 17 here: <input type="text" id="dependentsInput"> |
| <br> |
| <br> |
| <label id="estimateLabel"></label><br> |
| <button id="recalculateButton">Click here to recalculate</button> |
| <script> |
| const incomeInput = document.getElementById('incomeInput'); |
| const dependentsInput = document.getElementById('dependentsInput'); |
| const estimateLabel = document.getElementById('estimateLabel'); |
| const recalculateButton = document.getElementById('recalculateButton'); |
| recalculateButton.onclick = function() { |
| let selectedValue = 0; |
| const radioButtons = document.querySelectorAll('input[name="filingStatus"]'); |
| for (const radioButton of radioButtons) { |
| if (radioButton.checked) { |
| selectedValue = radioButton.value; |
| } |
| } |
| const headcount = [1, 2, 1]; |
| const limit = [75000, 150000, 112500]; |
| let income = Number(incomeInput.value); |
| let dependents = Number(dependentsInput.value); |
| let estimate = 600 * (headcount[selectedValue] + dependents); |
| let amountOverLimit = Math.max(0, income - limit[selectedValue]); |
| let reductionAmount = amountOverLimit * .05; |
| let finalEstimate = Math.max(0, estimate - reductionAmount); |
| estimateLabel.innerText = "You are likely to receive: " + finalEstimate; |
| }; |
| </script> |
| </body> |
| </html> |
And finally this is how it actually works.
For income, enter your AGI (Adjusted Gross Income - from field 8b of your last form 1040), without commas.