0

我有一个计算器,带有不同格式(货币、百分比等)的各种数字输入。

我希望在键入时对输入进行格式化,以便更容易使用计算器。

到目前为止,我已经尝试使用 jquery UI 进行格式化。虽然它在前端工作,但我不能使用返回的值在后台进行计算,因为它们是格式化的。

<input class="form-control-cur" id="price" value=300000 min=0>

$(".form-control-cur").spinner({
 min: 0,
 numberFormat: "C",
 culture: "de-DE",
 step: 100
});

当我尝试使用该值时:

var price = (document.getElementById("price").value);

该值的格式为 300.000,00 €</p>

我需要做什么才能获得值“300000”而不是“300.000,00 €”?

4

1 回答 1

0

尝试

$( ".form-control-cur" ).spinner("value")

获取内部值

于 2019-11-16T11:21:53.350 回答