【发布时间】:2021-11-27 13:11:57
【问题描述】:
你好,我必须有千位分隔符。如果您在输入字段中输入数字,则必须实时查看。数据类型是整数。问题是该函数在每个数字后添加点。
function numberDots(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ".");
}
<div class="form-group">
<input type="text" asp-for="inputfield" class="form-control text-right" onkeyup="this.value=numberWithDots(this.value);"/>
<span asp-validation-for="inputfield" class="text-danger"></span>
</div>
这是我的代码。我想要这个:222.222 但我得到了这个:2.2.2.222
你能帮帮我吗?
【问题讨论】:
标签: javascript asp.net-core model-view-controller view separator