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
Post a Comment