Currently, I am working on a fitness application that involves showcasing BMI data using a gauge. However, I am struggling to figure out how to dynamically change the value of the gauge. In addition, when trying to implement the gauge script on button click, I encounter an error stating "No element with id: 'gauge' found!". As I am relatively new to JavaScript, I would greatly appreciate any assistance in addressing both of these issues. Please provide guidance and corrections as needed.
<html>
<head>
<script src="raphael.2.1.0.min.js"></script>
<script src="justgage.1.0.1.min.js"></script>
<script type="text/javascript">
function calculateBMI()
{
var weight=document.getElementById("weight");
var height=document.getElementById("height");
var heightDouble=height.value*height.value;
var bmi=weight.value/heightDouble;
document.getElementById("bmi").innerHTML=bmi;
updateGauge();
}
</script>
</head>
<body>
<input type="text" id="weight"/>
<input type="text" id="height"/>
<input type="button" id="calculate" onClick="calculateBMI()"/>
<div id="bmi"></id>
<div id="gauge"></div>
<script>
function updateGauge()
{
var g = new JustGage({
id: "gauge",
value: 10,
min: 0,
max: 100,
title: "Visitors"
});
}
</script>
</body>
</html>