I am a beginner to JavaScript. I am buliding a BMI calculator. It gives the output for a few milliseconds and then the result disappears.
<!DOCTYPE html>
<html>
<head>
<title>BMI Calculator</title>
</head>
<body>
<form>
Weight:-<input type="text" id="wtxt"><br>
Height:-<input type="text" id="htxt"><br>
BMI:-<input type="text" id="bmitxt"><br>
<input type="reset" value="clear"><br>
<button onclick="calcbmi()">Calc BMI</button>
</form>
<script type="text/javascript">
function calcbmi(){
var w=parseInt(document.getElementById('wtxt').value);
var h=parseInt(document.getElementById('htxt').value);
var z=w/(h*h);
document.getElementById('bmitxt').value=z;
}
</script>
</body>
</html>