I am currently delving into the realm of Java-script, with the goal of creating an input field for numbers. My vision is to have a scenario where when a user enters a number in the input field, my script will display it in a paragraph or another text field. Subsequently, if the user fills in another number in the initial text field, the script should calculate the sum of the two values together.
Is it feasible to achieve something like this?
var number = document.getElementById("numInput");
var result = document.getElementById("numOutput");
number.onchange = function() {calculate()};
function calculate(){
result.innerHTML = number.value + " + " + "next value" + " + " + "and so on";
result.style.display = 'block';
}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<script src="script.js" async></script>
</head>
<body>
<input type="text" id="numInput">
<br>
<p id="numOutput"></p>
</body>
</html>