Move comma position JavaScript -


i'm trying move position of comma use of javascript. have managed remove parts of string needed removing. problem comma in wrong position.

the current outcome 425.00, want '42.50'

success: function(result) {    if (result != '') {       alert(" "+result+" ");    }     var discountval = result.replace(/\d/g,'');    newdiscountval = discountval.replace(7.50, '');    $("input#amount").val(discountval); } 

i grabbing database echo values combination of string , echo - numbers..

if number can divide 10

if string can this:

var ind = text.indexof('.'); text = text.replace('.', ''); text.slice(0, ind-1) + '.' + text.slice(ind-1, text.length) 

Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -