I am trying to make a custom calculator. Basicallt I want the answer for Number 1 + answer for Number 2 then show up in Results after clicking the Show Results button. It won’t work and I don’t know why.
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Title</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link rel="stylesheet" href="style.css">
<style type="text/css">
</style>
</head>
<body>
<div class="container">
<h2>Kovaak's Sensetivity Converter</h2>
<form>
<div class="inputfield">
<input type="text" name="txtnum1" required="">
<label>Number 1</label>
<span></span>
</div>
</form>
<form>
<div class="inputfield">
<input type="text" name="txtnum2" required="">
<label>Number 2</label>
<span></span>
</div>
</form>
<form>
<div class="inputfield">
<input type="text" name="txtres" required="">
<label>Results</label>
<span></span>
</div>
</form>
<input type="button" value="Show Results" class="btn" onClick="sumValues()">
</div>
<script type="text/javascript">
function sumValues()
{
var num1, num2, res;
num1=Number(document.inputfield.txtnum1.value);
num2=Number(document.inputfield.txtnum2.value);
res=num1+num2;
document.inputfield.txtres.value=res;
}
</script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script>
<script type="text/javascript"></script>
</body>