JSFiddle - React, Tailwind, and code Playground
by schawaska
HTML
<body>
<span id="ID_bmiResult2"> </span>
</body>
JavaScript
// these are the variables you're using in your calc, I have no idea of their
// actual values so I'm just assigning some bogus value for the test
var weight = 190;
var heightInMeter = 1.73;
// here we're getting the reference to the span
// theSpan is now the actual span
var theSpan = document.getElementById("ID_bmiResult2");
// now we calculate the result into theResult
var theResult = (weight / (heightInMeter * heightInMeter));
// here we're setting the innerHTML with the result, as well as fixing it
// with only 2 decimal points and making it a string (doesn't matter that much in this case tho)
theSpan.innerHTML = theResult.toFixed(2).toString();