The system does not work when you type comma number, for example 2,14, 22,14 and etc ... only with end point 2.14, 22.14 and etc ... Below is the function I use. How to use function with the number typed with comma, do not present the error NaN and the result also appears with comma. Would it be possible to restrict the use of dot in the field or even issue an alert if the user types "."? Many thanks.
<script>
$(function(){
$('.temp').change(function(){
var total = 0;
var notas = 0;
$('.temp').each(function(){
var nota = Number(this.value);
if(nota === 0) return;
total = total + nota;
notas++;
})
var t = (total/notas).toFixed(2);
$('#media_temperaturaE').val(t);
});
})
Below the screen for entering numbers to perform the calculation, with both examples.