I'm in the process of creating a website and I would like to incorporate a progress bar that reflects the average of all the input numbers obtained from an HTML form.
Although I have some experience with JavaScript, I am currently in need of the JavaScript code for this specific functionality.
<div class="">
<h3 class="card-header">Notes</h3>
<div class="card-body">
<div class="alert alert-warning" role="alert">
Note: Please enter grades for courses ranging from 0 to 20
</div>
<div class="form-group row">
<label class="col-12 col-sm-4 col-form-label text-sm-right">Math:</label>
<div class="col-12 col-sm-8 col-lg-3">
<input id="math" type="number" required="" name="math" class="form-control" min="0" max="20">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-4 col-form-label text-sm-right">History:</label>
<div class="col-12 col-sm-8 col-lg-3">
<input id="history" type="number" required="" name="history" class="form-control" min="0" max="20">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-4 col-form-label text-sm-right">Biology:</label>
<div class="col-12 col-sm-8 col-lg-3">
<input id="biology" type="number" required="" name="biology" class="form-control" min="0" max="20">
</div>
</div>
<div class="form-group row">
<label class="col-12 col-sm-4 col-form-label text-sm-right">Geography:</label>
<div class="col-12 col-sm-8 col-lg-3">
<input id="" type="number" required="" name="geography" class="form-control" min="0" max="20">
</div>
</div>
<input type="submit" value="Submit" class="btn btn-space btn-primary" onclick="submitForms()">
</div>
</div>
</form>
Does anyone know how to write the JavaScript code so that upon submitting the results, a horizontal progress bar displaying the corresponding grade is generated based on the average of the scores?
Your assistance would be greatly appreciated.
Thank you in advance.