My goal is to learn Javascript on my own, but I'm struggling to make progress. I've created a function called fixedSpending() that takes two inputs, num1 and num2, and adds them together. However, when the user hits the "=" button, I expect the function to return the total. Unfortunately, this isn't happening as I keep encountering an uncaught reference error in the console stating that fixedSpending() is not defined. I'm confused as to why this error is occurring.
I would greatly appreciate any assistance or resources for learning more about this topic.
<html>
<head>
<title>
Budget Form
<script type="text/javascript">
function fixedSpending(){
var num1=parseFloat(document.getElementById("num1").value)
var num2=parseFloat(document.getElementById("num2").value)
return document.getElementById('result').value= num1 + num2;
}
</script>
</title>
</head>
<body>
<h2></h2>
<br>
num1: <input type="text" id="num1" maxlength="10"><br>
num2: <input type="text" id="num2" maxlength="10"><br>
<input type="Button" value= "=" onclick="fixedSpending();"><br>
Result: <input type="text" id="result">
</body>
</html>
The error message reads: Uncaught ReferenceError: fixedSpending is not defined