Replace dot to comma jQuery (newbie) -


im new in community, im trying replace dot comma in simple math operation, need help. many all.

something this: jquery replace dot comma , round it

$('#kilometros').keyup(function() {     var kilometros = parsefloat($(this).val());    var preciokilometros = parsefloat($('#preciokilometros').val());    var totalkilometros = $('#totalkilometros').html((kilometros * preciokilometros));         totalkilometros.replace(".", ","); 

});

$('#totalkilometros').html(...) returns jquery object, doesn't have replace method.

do instead:

var totalkilometros = (kilometros * preciokilometros).tostring().replace('.', ','); $('#totalkilometros').html(totalkilometros); 

Comments

Popular posts from this blog

linux - xterm copying to CLIPBOARD using copy-selection causes automatic updating of CLIPBOARD upon mouse selection -

qt - Errors in generated MOC files for QT5 from cmake -