2
Good afternoon! The code below calculates the average, however, depending on the value it is periodically decimated, how to round the values in decimals, 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);
});
})
http://answall.com/q/11018/101
– Maniero
I haven’t been able to round up yet (.00), does anyone have any ideas to help me? Thanks
– Quito Gaspar