So I have this code which basically does a simple math function but now I do not know how to link the <input> and the <output> tags with the JavaScript so that when users put a digit in <input> the script is run and the result is displayed in the <output>
Any help is appreciated and please be helpful as I am still learning.
function computation(number) {
let newNumber = number + (1/100 * number) + 1000;
let roundedNumber = Math.round(newNumber/100)*100;
return roundedNumber;
}
<p>Enter Amount Here:</p>
<input type="text" name="value"></input>
<button class="button" onClick="computation()">Calculate!</button>
<p>Final Amount</p>
<div class="output">
<output for="roundedNumber" name="finalAmount"></output>
</div>
scripttag and in thesrcattribute give the path of the externalJSfile<input>then the script should run and the final answer should be given out in the<output>