I'm creating a cumulative GPA calculator and I can't get the calculator to output any values. Is there anything I'm doing wrong with the code or calculation?
<div id="Cumulative GPA" class="tabcontent">
<p2>Cumulative GPA <b>before</b> this semester:</p2>
<input type="number" id="oldcumulativegpa">
<br />
<p2><b>Number of semesters</b> your Old Cumulative GPA was calculated with:</p2>
<input type="number" id="numberofsemesters">
<br />
<p2>Your GPA <b>this semester</b>:</p2>
<input type="number" id="currentsemestergpa">
<script>
document.getElementById("oldcumulativegpa").onkeydown = function() {myJsFunction()};
function myJsFunction() {
var oldcumulativegpa = document.getElementById('oldcumulativegpa').value;
var currentsemestergpa = document.getElementById('currentsemestergpa').value;
var numberofsemesters = document.getElementById('numberofsemesters').value;
newcumulativegpa = (oldcumulativegpa*numberofsemesters + currentsemestergpa)/(numberofsemesters + 1);
}
</script>
<p2>Your <b>New Cumulative GPA:</p2>
<p id="newcumulativegpa"></p>
</div>
`, not ``? Also, you're missing a closing `` for the new cumulative GPA label
– Chris Forrence Jun 27 '18 at 17:15