我使用数字作为我的钱输入值,所以当我键入数字时
15000 then it should be 15,000
55350 became 55,350
但是当我保存输入时,为什么在我的数据库中存储为
15.00 and 55.00
即时通讯使用decimal(18,2)
获取此货币价值
这是我在输入类上的代码
$(document).ready(function () {
$(".mny").number(true);
}
我错过了什么或我应该转换价值? THA
你这样试试,
$(document).ready(function () {
var withComma = $('#value').val().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
var replaceDot = withComma.replace(/,/g, ".");
console.log(withComma , replaceDot);
});