Sololearn: Learn to Code
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2
You got multiple issues. Your trying to access the DOM prior to it being loaded. Your calculations are done prior to the user entering the data or hitting the calculate button. Put the last two lines (onclick statement) within: window.onload = function() { } so it happens after the DOM is loaded. Move all the rest of the code within your gpcalc function so it happens after the user asks for the gpa.
23rd Oct 2018, 11:17 PM
John Wells
John Wells - avatar