Good afternoon! The code below performs the calculation of the mean, however, depending on the value it gets periodic decimal, how to round the values in decimal places, for example 0.00 or 00.00? Thank you.
HTML:
Nota 1: <input class="nota" /><br/>
Nota 2: <input class="nota" /><br/>
Nota 3: <input class="nota" /><br/><br/>
Media: <input id="media" readonly/>
JQUERY:
$(function(){
$('.nota').change(function(){
var total = 0;
var notas = 0;
$('.nota').each(function(){
var nota = new Number(this.value);
if(nota === 0) return;
total = total + nota;
notas++;
})
$('#media').val(total/notas);
});
})