I am trying to make a BMI Calculator using HTML. The inputs come from text fields. I am making some calculation with them in a Javascript function. I want to get the calcula
If you have a variable like calcResult, you can do:
document.getElementById('spanId').innerHTML += calcResult;
Of course, that only works once. If you do it again, you'll have two results in the span. If you want to be able to change the result if the form fields change, I'd try:
Your calculation result =
var result = 12;
document.getElementById('calc').getElementsByTagName('span')[0].innerHTML = result;