I can't seem to figure out why document.getElementById(...).value
won't write to the text fields in the following code:
</div>
<div id="righta">
<input type="text" name="league" id="league" readonly onload = "calcTotal()"/>League Dues
<br />
<input type="text" name="fee" id="fee" readonly onload = "calcTotal()"/>Golf Course Fees
<br />
<input type="text" name="total" id="total" readonly onload = "calcTotal()" />Total for the Season
</div>
</form>
</div>
</div>
<div id="footer">
<p> For more information, contact the League Director</p>
</div>
</div>
<script>
function calcTotal() {
const DUES = 6;
const FEES = 16.50;
const WEEKS = 12;
var owedDues = (DUES * WEEKS);
var owedFees = (FEES * WEEKS);
var totalOwed = (owedDues + owedFees);
document.getElementById('league').value = "$" + owedDues.toFixed(2);
document.getElementById('fee').value = "$" + owedFees.toFixed(2);
document.getElementById('total').value = "$" + totalOwed.toFixed(2);
}
</script>
</body>